mirror of
https://github.com/janet-lang/janet
synced 2025-01-22 21:26:51 +00:00
Make test output less verbose
This commit is contained in:
parent
2833a983d8
commit
0284df503f
@ -5,6 +5,8 @@
|
|||||||
(var suite-num 0)
|
(var suite-num 0)
|
||||||
(var start-time 0)
|
(var start-time 0)
|
||||||
|
|
||||||
|
(def is-verbose (os/getenv "VERBOSE"))
|
||||||
|
|
||||||
(defn assert
|
(defn assert
|
||||||
"Override's the default assert with some nice error handling."
|
"Override's the default assert with some nice error handling."
|
||||||
[x &opt e]
|
[x &opt e]
|
||||||
@ -15,7 +17,7 @@
|
|||||||
(def truncated
|
(def truncated
|
||||||
(if (> (length e) 40) (string (string/slice e 0 35) "...") (describe e)))
|
(if (> (length e) 40) (string (string/slice e 0 35) "...") (describe e)))
|
||||||
(if x
|
(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))
|
(eprintf "\n\e[31m✘\e[0m %s: %v" truncated x))
|
||||||
x)
|
x)
|
||||||
|
|
||||||
@ -32,10 +34,10 @@
|
|||||||
(defn start-suite [x]
|
(defn start-suite [x]
|
||||||
(set suite-num x)
|
(set suite-num x)
|
||||||
(set start-time (os/clock))
|
(set start-time (os/clock))
|
||||||
(eprint "\nRunning test suite " x " tests...\n "))
|
(eprint "Running test suite " x " tests..."))
|
||||||
|
|
||||||
(defn end-suite []
|
(defn end-suite []
|
||||||
(def delta (- (os/clock) start-time))
|
(def delta (- (os/clock) start-time))
|
||||||
(eprintf "\n\nTest suite %d finished in %.3f seconds" suite-num delta)
|
(eprintf "Test suite %d finished in %.3f seconds" suite-num delta)
|
||||||
(eprint num-tests-passed " of " num-tests-run " tests passed.\n")
|
(eprint num-tests-passed " of " num-tests-run " tests passed.")
|
||||||
(if (not= num-tests-passed num-tests-run) (os/exit 1)))
|
(if (not= num-tests-passed num-tests-run) (os/exit 1)))
|
||||||
|
@ -308,8 +308,9 @@
|
|||||||
(assert (deep= (range 4) a) "eachk 1")
|
(assert (deep= (range 4) a) "eachk 1")
|
||||||
|
|
||||||
|
|
||||||
|
(with-dyns [:err @""]
|
||||||
(tracev (def my-unique-var-name true))
|
(tracev (def my-unique-var-name true))
|
||||||
(assert my-unique-var-name "tracev upscopes")
|
(assert my-unique-var-name "tracev upscopes"))
|
||||||
|
|
||||||
(assert (pos? (length (gensym))) "gensym not empty, regression #753")
|
(assert (pos? (length (gensym))) "gensym not empty, regression #753")
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@
|
|||||||
(def step1 "(a b c d)\n")
|
(def step1 "(a b c d)\n")
|
||||||
(def step2 "(a b)\n")
|
(def step2 "(a b)\n")
|
||||||
(def p1 (parser/new))
|
(def p1 (parser/new))
|
||||||
(pp (parser/state p1))
|
(parser/state p1)
|
||||||
(parser/consume p1 step1)
|
(parser/consume p1 step1)
|
||||||
(loop [v :iterate (parser/produce p1)])
|
(loop [v :iterate (parser/produce p1)])
|
||||||
(parser/state p1)
|
(parser/state p1)
|
||||||
|
Loading…
Reference in New Issue
Block a user