diff --git a/test/helper.janet b/test/helper.janet index 0d97265b..fff58e89 100644 --- a/test/helper.janet +++ b/test/helper.janet @@ -5,6 +5,8 @@ (var suite-num 0) (var start-time 0) +(def is-verbose (os/getenv "VERBOSE")) + (defn assert "Override's the default assert with some nice error handling." [x &opt e] @@ -15,7 +17,7 @@ (def truncated (if (> (length e) 40) (string (string/slice e 0 35) "...") (describe e))) (if x - (eprintf "\e[32m✔\e[0m %s: %v" truncated x) + (when is-verbose (eprintf "\e[32m✔\e[0m %s: %v" truncated x)) (eprintf "\n\e[31m✘\e[0m %s: %v" truncated x)) x) @@ -32,10 +34,10 @@ (defn start-suite [x] (set suite-num x) (set start-time (os/clock)) - (eprint "\nRunning test suite " x " tests...\n ")) + (eprint "Running test suite " x " tests...")) (defn end-suite [] (def delta (- (os/clock) start-time)) - (eprintf "\n\nTest suite %d finished in %.3f seconds" suite-num delta) - (eprint num-tests-passed " of " num-tests-run " tests passed.\n") + (eprintf "Test suite %d finished in %.3f seconds" suite-num delta) + (eprint num-tests-passed " of " num-tests-run " tests passed.") (if (not= num-tests-passed num-tests-run) (os/exit 1))) diff --git a/test/suite0007.janet b/test/suite0007.janet index f24aa1a1..aedc8b8f 100644 --- a/test/suite0007.janet +++ b/test/suite0007.janet @@ -308,8 +308,9 @@ (assert (deep= (range 4) a) "eachk 1") -(tracev (def my-unique-var-name true)) -(assert my-unique-var-name "tracev upscopes") +(with-dyns [:err @""] + (tracev (def my-unique-var-name true)) + (assert my-unique-var-name "tracev upscopes")) (assert (pos? (length (gensym))) "gensym not empty, regression #753") diff --git a/test/suite0010.janet b/test/suite0010.janet index 2550361c..6f8e0d73 100644 --- a/test/suite0010.janet +++ b/test/suite0010.janet @@ -203,7 +203,7 @@ (def step1 "(a b c d)\n") (def step2 "(a b)\n") (def p1 (parser/new)) -(pp (parser/state p1)) +(parser/state p1) (parser/consume p1 step1) (loop [v :iterate (parser/produce p1)]) (parser/state p1)