balls/spec

Source   Edit  

Types

ExpectedError = object of CatchableError
Source   Edit  
FailError = object of CatchableError
Source   Edit  
SkipError = object of CatchableError
Source   Edit  
StatusKind = enum
  None = "  ",              ## (undefined)
  Info = "🔵",            ## may prefix information
  Wait = "⏳",             ## pending cache access
  Runs = "🏃",            ## currently runs
  Pass = "🟢",            ## total success
  Skip = "❔",             ## test was skipped
  Part = "🟡",            ## partial success
  Fail = "🔴",            ## assertion failure
  Died = "💥",            ## unexpected exception
  Oops = "⛔"               ## compiles() failed
possible test results Source   Edit  
Test = object
  status*: StatusKind        ## the result of the test
  code*: NimNode             ## the user's original code
  node*: NimNode             ## the test and its instrumentation
  name*: string              ## the name of the test, duh
  number*: int               ## tests tend to get unique numbers
  clock*: float              ## used to measure test timing
  memory*: int               ## used to measure test memory
Source   Edit  

Consts

ballsDry {.booldefine.} = false
Source   Edit  
emojiSource = " 🗏 "
Source   Edit  
emojiStack = " 🗇 "
Source   Edit  
hasDefects = true
Source   Edit  
hasPanics = false
Source   Edit  
onCI {.used.} = true
Source   Edit  
testable = {nnkBlockStmt, nnkIfStmt, nnkWhileStmt, nnkForStmt, nnkTryStmt,
            nnkReturnStmt, nnkYieldStmt, nnkDiscardStmt, nnkContinueStmt,
            nnkAsmStmt, nnkImportStmt, nnkImportExceptStmt, nnkExportStmt,
            nnkExportExceptStmt, nnkFromStmt, nnkIncludeStmt, nnkCommand,
            nnkCall, nnkWhenStmt}
Source   Edit  

Procs

proc dollar(n: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
If it's not a string literal, dollar it. Source   Edit  
proc flushStreams() {.noconv, used, ...raises: [], tags: [WriteIOEffect],
                      forbids: [].}
Convenience for flushing stdmsg() during process exit. Source   Edit  
proc init(test: var Test; name: string; code: NimNode) {....raises: [], tags: [],
    forbids: [].}
initialize a test with the most basic input possible Source   Edit  
proc setBallsResult(q: int) {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc totalTests(): int {....raises: [], tags: [], forbids: [].}
reveal the value of the counter without exposing it Source   Edit  

Templates

template noclobber(body: untyped)
serialize access to the body; usually for output reasons Source   Edit