ref: 35c02af69dcc70507e639209eeea181e8e088366
parent: 056ef88fc6d281ae626ddf2c598afe2abdb06888
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Sep 26 23:22:40 EDT 2015
Make the closure test a bit more useful. Make sure we capture shit in the right order.
--- 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()
}
--- a/test/tests
+++ b/test/tests
@@ -58,7 +58,7 @@
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