diff options
-rw-r--r-- | tests/012/ifa.tl | 7 | ||||
-rw-r--r-- | tests/common.tl | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/tests/012/ifa.tl b/tests/012/ifa.tl index d669244d..45a2939b 100644 --- a/tests/012/ifa.tl +++ b/tests/012/ifa.tl @@ -10,8 +10,11 @@ (isqrt it))) 7) -;; ambiguous: is "it" x or is "it" y? -(test (let (x y) (ifa (> x y) (print it))) :error) +;; no it-candidates: "it" is leftmost arg x. +(test (let ((x 1) (y 0)) (ifa (> x y) it)) 1) + +;; multiple it-candidates: error +(test (let (x y) (ifa (> (* x x) (* y y)) it)) :error) ;; "it" is (+ 3 (* 2 x)) (test (let ((x 5)) diff --git a/tests/common.tl b/tests/common.tl index 3cd5df63..3eef8d31 100644 --- a/tests/common.tl +++ b/tests/common.tl @@ -4,14 +4,14 @@ (defmacro vtest (:env env expr expected) (catch - (let ((expr-expn (macroexpand expr env)) + (let ((expr-expn (expand expr env)) (expval (gensym))) ^(let ((,expval ,expected)) (ifa (not (equal (error-to-sym ,expr-expn) ,expval)) (error "test case ~s failed: produced ~s; expected ~s" ',expr it ,expval)))) (error (exc) - (unless (eq expected :error) + (unless (eq (eval expected) :error) (error "test case ~s failed to expand: expected is ~s" expr expected))))) (defmacro test (expr expected) |