summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-05-26 14:54:02 -0700
committerOri Bernstein <ori@eigenstate.org>2018-06-03 17:17:45 -0700
commitf75a890bab649f57ee1f2cfffec8c74cc8b0ed49 (patch)
tree9808b2ad80a25ccca2db83188916b5adbfb6b55e /test
parent05764878243785d7bae1dda067d86eb9bcaec443 (diff)
downloadmc-f75a890bab649f57ee1f2cfffec8c74cc8b0ed49.tar.gz
Add test for recursive closure.
Diffstat (limited to 'test')
-rw-r--r--test/closurerec.myr15
-rw-r--r--test/tests1
2 files changed, 16 insertions, 0 deletions
diff --git a/test/closurerec.myr b/test/closurerec.myr
new file mode 100644
index 0000000..61fc45e
--- /dev/null
+++ b/test/closurerec.myr
@@ -0,0 +1,15 @@
+use std
+
+const main = {
+ const fib = {n
+ if n <= 0
+ -> 0
+ elif n == 1
+ -> 1
+ else
+ -> fib(n - 1) + fib(n - 2)
+ ;;
+ }
+ std.exit(fib(8))
+}
+
diff --git a/test/tests b/test/tests
index ef2bf9a..3fa19f6 100644
--- a/test/tests
+++ b/test/tests
@@ -64,6 +64,7 @@ B callbig E 42
B nestfn E 42
B foldidx P 123,456
B closure P 111555333666
+B closurerec E 21
B fncast P ok
B loop P 0123401236789
B subrangefor P 12