1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-30 07:03:02 +00:00

More changes to threading model.

This commit is contained in:
Calvin Rose
2017-07-01 11:17:29 -04:00
parent c380f8a2ca
commit 957a513fd6
2 changed files with 41 additions and 18 deletions

View File

@@ -1,14 +1,17 @@
(print "Running basic tests...")
(var numTestsPassed 0)
(def assert (fn [x e]
(var num-tests-passed 0)
(var num-tests-run 0)
(def assert (fn [x e]
(varset! num-tests-run (+ 1 num-tests-run))
(if x
(do
(print " \e[32m✔\e[0m" e)
(varset! numTestsPassed (+ 1 numTestsPassed)) x)
(varset! num-tests-passed (+ 1 num-tests-passed))
x)
(do
(print e)
(exit! (+ numTestsPassed 1))))))
(print " \e[31m✘\e[0m" e)
x))))
(assert (= 10 (+ 1 2 3 4)) "addition")
(assert (= -8 (- 1 2 3 4)) "subtraction")
@@ -77,7 +80,7 @@
(assert (= athread-result "hello, world!") "thread error result")
(assert (= (status athread) "error") "thread error status")
"All tests passed"
"report"
(print "All" numTestsPassed "tests passed")
(print num-tests-passed "of" num-tests-run "tests passed")
(exit! 0)