mirror of
https://github.com/janet-lang/janet
synced 2024-11-05 16:26:17 +00:00
4e4dd31164
Add quasiquote, unquote, and unquote-splicing as specials rather than a macro.
23 lines
533 B
Plaintext
23 lines
533 B
Plaintext
# Helper code for running tests
|
|
|
|
(var num-tests-passed 0)
|
|
(var num-tests-run 0)
|
|
(var suite-num 0)
|
|
|
|
(defn assert [x e]
|
|
(++ num-tests-run)
|
|
(when x (++ num-tests-passed))
|
|
(print (if x
|
|
" \e[32m✔\e[0m "
|
|
" \e[31m✘\e[0m ") e)
|
|
x)
|
|
|
|
(defn start-suite [x]
|
|
(:= suite-num x)
|
|
(print "\nRunning test suite " x " tests...\n"))
|
|
|
|
(defn end-suite []
|
|
(print "\nTest suite " suite-num " finished.")
|
|
(print num-tests-passed " of " num-tests-run " tests passed.\n")
|
|
(if (not= num-tests-passed num-tests-run) (os/exit 1)))
|