X-Git-Url: http://git.lukelau.me/?p=scheme.git;a=blobdiff_plain;f=tests.scm;h=30d23f61ed6375c786574a1d18056eb0278b398a;hp=4e50dc61908cee17c4d1c1ada96c57282abf5830;hb=844dcd052c6f551d9936693c2b4c49cf920c7051;hpb=a64f7097fa246c19a4c69d0aad65e60378273887 diff --git a/tests.scm b/tests.scm index 4e50dc6..30d23f6 100644 --- a/tests.scm +++ b/tests.scm @@ -43,6 +43,15 @@ (let ((str (read-file "/tmp/test-output.txt"))) (test str output))) +(test (data-tors '(data A + (foo Int Bool) + (bar Bool))) + '((foo . (abs Int (abs Bool A))) + (foo~0 . (abs A Int)) + (foo~1 . (abs A Bool)) + (bar . (abs Bool A)) + (bar~0 . (abs A Bool)))) + (test-types (typecheck '((lambda (x) (+ ((lambda (y) (x y 3)) 5) 2)))) '(abs (abs Int (abs Int Int)) Int)) @@ -168,3 +177,15 @@ (go p 1)))]) (pow 4 2)) 16) + +(test-prog-stdout '(let ([f (lambda (n) + (if (= n 0) + 0 + (let () + (print "a") + (g (- n 1)))))] + [g (lambda (m) + (let () + (print "b") + (f (- m 1))))]) + (f 10)) "ababababab")