summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-27 03:22:40 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-27 03:22:40 -0700
commit35c02af69dcc70507e639209eeea181e8e088366 (patch)
tree8e3ce181c30c91d6a3c8c16a4fb79866e98b4498 /test
parent056ef88fc6d281ae626ddf2c598afe2abdb06888 (diff)
downloadmc-35c02af69dcc70507e639209eeea181e8e088366.tar.gz
Make the closure test a bit more useful.
Make sure we capture shit in the right order.
Diffstat (limited to 'test')
-rw-r--r--test/closure.myr16
-rw-r--r--test/tests2
2 files changed, 12 insertions, 6 deletions
diff --git a/test/closure.myr b/test/closure.myr
index c7089d3..d24cdab 100644
--- a/test/closure.myr
+++ b/test/closure.myr
@@ -1,10 +1,16 @@
use std
-/* checks that functions with environment capture work. should exit with 42. */
const main = {
- var a = 42
- var f = {b
- -> a + b
+ var a, b, c, fn
+
+ a = 111
+ b = 555
+ c = 333
+ fn = {
+ var x
+
+ x = 666
+ std.put("{}{}{}{}\n", a, b, c, x)
}
- std.exit(f(13))
+ fn()
}
diff --git a/test/tests b/test/tests
index c93d373..e24a6c5 100644
--- a/test/tests
+++ b/test/tests
@@ -58,7 +58,7 @@ B voidcall E 12
B callbig E 42
B nestfn E 42
B foldidx P 123,456
-B closure E 55
+B closure P 111555333666
B loop P 0123401236789
B subrangefor P 12
B patiter P 23512