X-Git-Url: https://git.lukelau.me/?p=scheme.git;a=blobdiff_plain;f=tests.scm;h=ecee99eed962aa94ea39ed8c0f16f4b9c32bc4fa;hp=fa5b195e1b2575c4d14f9e385c854aad53dd0823;hb=8e106ca13666680051f91ab3f49ce2bd7e19ead7;hpb=006b94f5a24a794665788737fec8d54086284317 diff --git a/tests.scm b/tests.scm index fa5b195..ecee99e 100644 --- a/tests.scm +++ b/tests.scm @@ -155,9 +155,7 @@ (test-types (typecheck - '((data A - [foo Int] - [bar Bool]) + '((data A [foo Int]) (let ([x (foo 42)] [(foo y) x]) x))) @@ -165,9 +163,7 @@ (test-types (typecheck - '((data A - [foo Int] - [bar Bool]) + '((data A [foo Int]) (let ([x (foo 42)] [(foo y) x]) y))) @@ -259,3 +255,20 @@ (let ([(foo x y) (foo (= 3 3) 42)]) y)) 42) + +(test-exception (expand-pattern-matches + '((data A [foo Int] + [bar Bool]) + (let ([(foo x) (foo 0)]) x)))) + +(test-prog '((data A [foo Int]) + (let ([x (foo 42)]) + (let ([(foo y) x]) + (+ 1 y)))) + 43) + +(test-prog '((data A [foo Int]) + (data B [bar A]) + (let ([(bar (foo x)) (bar (foo 42))]) + x)) + 42)