1
0
mirror of https://github.com/janet-lang/janet synced 2025-02-08 21:10:02 +00:00

Update issue 53 regression test.

Some tests did not call assert so did not show up on report.
This commit is contained in:
Calvin Rose 2019-02-21 19:19:47 -05:00
parent 1147482e62
commit f4908ebc41
2 changed files with 17 additions and 6 deletions

View File

@ -26,6 +26,11 @@
(def errsym (keyword (gensym))) (def errsym (keyword (gensym)))
~(assert (= ,errsym (try (do ,;forms) ([_] ,errsym))) ,msg)) ~(assert (= ,errsym (try (do ,;forms) ([_] ,errsym))) ,msg))
(defmacro assert-no-error
[msg & forms]
(def errsym (keyword (gensym)))
~(assert (not= ,errsym (try (do ,;forms) ([_] ,errsym))) ,msg))
(defn start-suite [x] (defn start-suite [x]
(set suite-num x) (set suite-num x)
(print "\nRunning test suite " x " tests...\n ")) (print "\nRunning test suite " x " tests...\n "))

View File

@ -47,13 +47,19 @@
(defn check-image (defn check-image
"Run a marshaling test using the make-image and load-image functions." "Run a marshaling test using the make-image and load-image functions."
[x] [x msg]
(def src (make-image x)) (assert-no-error msg (load-image (make-image x))))
(load-image src))
(check-image (fn [] (fn [] 1))) (check-image (fn [] (fn [] 1)) "marshal nested functions")
(check-image (fiber/new (fn [] (fn [] 1)))) (check-image (fiber/new (fn [] (fn [] 1))) "marshal nested functions in fiber")
(check-image (fiber/new (fn [] (fiber/new (fn [] 1))))) (check-image (fiber/new (fn [] (fiber/new (fn [] 1)))) "marshal nested fibers")
(def issue-53-x
(fiber/new
(fn []
(var y (fiber/new (fn [] (print "1") (yield) (print "2")))))))
(check-image issue-53-x "issue 53 regression")
(end-suite) (end-suite)