summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2011-11-10 04:39:46 +0200
committerZahary Karadjov <zahary@gmail.com>2011-11-10 04:39:46 +0200
commitda4076e0b7d3336d28893feba1399028abdbd52e (patch)
tree61cc0f7f79a7a004b770852492c0fc6bd2239e64 /tests
parent489340658ea855d01de853d3c95c928d6e1b9f86 (diff)
downloadNim-da4076e0b7d3336d28893feba1399028abdbd52e.tar.gz
when running unit tests, the tester will print only failures using colorless output (this should be better for nimbuild)
Diffstat (limited to 'tests')
-rw-r--r--tests/accept/run/tunit.nim47
-rwxr-xr-xtests/tester.nim3
2 files changed, 3 insertions, 47 deletions
diff --git a/tests/accept/run/tunit.nim b/tests/accept/run/tunit.nim
deleted file mode 100644
index d0e975119..000000000
--- a/tests/accept/run/tunit.nim
+++ /dev/null
@@ -1,47 +0,0 @@
-import

-  unittest, macros

-

-var

-    a = 1

-    b = 22

-    c = 1

-    d = 3

-

-suite "my suite":

-  setup:

-    echo "suite setup"

-    var testVar = "from setup"

-    

-  teardown:

-    echo "suite teardown"

-

-  test "first suite test":

-    testVar = "modified"

-    echo "test var: " & testVar

-    check a > b

-

-  test "second suite test":

-    echo "test var: " & testVar

-

-proc foo: bool =

-  echo "running foo"

-  return true

-

-proc err =

-  raise newException(EArithmetic, "some exception")

-

-test "final test":

-  echo "inside suite-less test"

-

-  check:

-    a == c

-    foo()

-    d > 10

-

-test "arithmetic failure":

-  expect(EArithmetic):

-    err()

-

-  expect(EArithmetic, ESystem):

-    discard foo()

-

diff --git a/tests/tester.nim b/tests/tester.nim
index 3f563de4a..1b88f9292 100755
--- a/tests/tester.nim
+++ b/tests/tester.nim
@@ -391,6 +391,9 @@ proc outputJSON(reject, compile, run: TResults) =
   writeFile(jsonFile, s)
 
 proc main() =
+  os.putenv "NIMTEST_NO_COLOR", "1"
+  os.putenv "NIMTEST_OUTPUT_LVL", "PRINT_FAILURES"
+
   const
     compileJson = "compile.json"
     runJson = "run.json"