Skip to content

Commit

Permalink
Skip macro suppression (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
saem authored May 27, 2021
1 parent a88fbad commit bfa0719
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions balls.nim
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,13 @@ proc skip*(msg = "skipped") =
## Manually skips the remainder of the current test.
raise newException(SkipError, msg)

template skip*(msg = "skipped", body: untyped) =
## Manually skips the remainder of the current test and
## stops macro processing.
skip(msg)
when false:
body

proc fail*(msg = "failed") =
## Manually fails the current test.
raise newException(FailError, msg)
Expand Down
4 changes: 4 additions & 0 deletions tests/test.nim
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ suite "a pretty suite shim":

block omitted:
skip("i just don't wanna")

block mostOmitted:
skip "i really just don't wanna":
{.error: "never got here".}

assert "any statement is a test" != ""
check r > 0, $r & " is a good test of dynamic messages"
Expand Down

0 comments on commit bfa0719

Please sign in to comment.