Don't run non-test code when defined(testing)

This commit is contained in:
Oleh Prypin 2015-04-21 14:37:29 +03:00
commit 32109a7867
46 changed files with 104 additions and 82 deletions

View file

@ -493,7 +493,8 @@ when isMainModule:
block: # filter iterator test
let numbers = @[1, 4, 5, 8, 9, 7, 4]
for n in filter(numbers, proc (x: int): bool = x mod 2 == 0):
echo($n)
when not defined(testing):
echo($n)
# echoes 4, 8, 4 in separate lines
block: # keepIf test
@ -616,4 +617,5 @@ when isMainModule:
#doAssert a.repeat(-1) == @[] # will not compile!
doAssert b.repeat(3) == @[]
echo "Finished doc tests"
when not defined(testing):
echo "Finished doc tests"