lib/lisp/tests/boot-tests.nydp in nydp-0.0.9 vs lib/lisp/tests/boot-tests.nydp in nydp-0.0.10

- old
+ new

@@ -29,10 +29,35 @@ (let f (fn (x0) (joinstr " " test-a0 x0 f0 x0 f1)) (map f (list w0 w1 w2 w3)))))) (register-test '(suite "Boot Tests" + (suite "conditionals" + ("single-expr 'if is just the expr" + (pre-compile '(if a)) + a) + + ("two-expr 'if expands to 'cond" + (pre-compile '(if a b)) + (cond a b)) + + ("three-expr 'if expands to 'cond" + (pre-compile '(if a b c)) + (cond a b c)) + + ("four-expr 'if expands to nested 'cond" + (pre-compile '(if a b c d)) + (cond a b (cond c d))) + + ("five-expr 'if expands to nested 'cond" + (pre-compile '(if a b c d e)) + (cond a b (cond c d e))) + + ("'unless expands to 'if" + (pre-compile '(unless x y z)) + (cond (no x) ((fn () y z))))) + (suite "hashtables" ("build a hash table from brace-list syntax" (let hsh { foo 1 bar 2 } (list 'foo hsh.foo 'bar hsh.bar)) (foo 1 bar 2)) @@ -109,10 +134,11 @@ ("a0 w0 x w0 y" "a0 w1 x w1 y" "a0 w2 x w2 y" "a0 w3 x w3 y")) (suite "mapx" ("provides a convenient simplification for 'map" (mapx '(1 2 3 4) n (* n 2)) - (2 4 6 8))) + (2 4 6 8)))) + (suite "pre-compile" (suite "bang-syntax" ("expansion" (pre-compile '(!eq? a b))