X-Git-Url: https://git.lukelau.me/?a=blobdiff_plain;f=tests.scm;h=d2711d7739ffaa2a671835d9be7f4bf6ed211f0d;hb=f4b0d5c1b14a1890e1b88398e256b272595346b2;hp=a3f4913a75d5e9177843da3d5a71ce2d24b0a8b4;hpb=a457cd3bb5ce9366db3ca0731a07abc50ecbc1f3;p=scheme.git diff --git a/tests.scm b/tests.scm index a3f4913..d2711d7 100644 --- a/tests.scm +++ b/tests.scm @@ -307,3 +307,19 @@ [(bar x) 0])) 12) +(test-prog '((data Foo [foo Int]) + (data Bar [bar Foo]) + (case (bar (foo 42)) + [(bar (foo x)) x])) + 42) + ; todo: make this error for incomplete pattern match +(test-prog '((data A [foo Int] [bar Int B]) + (data B [baz Int]) + (let ([val (bar 42 (baz 12))]) + (case val + [(foo 42) 0] + [(bar 32 (baz 12)) 1] + [(bar 42 (baz x)) x] + [(foo x) 2]))) + 12) +