1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-22 11:17:40 +00:00

Fix = should have been ==. Add some tests for vm type asserts.

This commit is contained in:
Calvin Rose
2019-01-08 12:21:11 -05:00
parent d5bab72620
commit 67f26b7d72
3 changed files with 13 additions and 1 deletions

View File

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

View File

@@ -122,4 +122,11 @@
(def spot (make-dog "spot"))
(assert (= "spot says hi!" (:bark spot "hi")) "oo 2")
# Negative tests
(assert-error "+ check types" (+ 1 ()))
(assert-error "- check types" (- 1 ()))
(assert-error "* check types" (* 1 ()))
(assert-error "/ check types" (/ 1 ()))
(end-suite)