diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/defer.toc | 17 | ||||
-rw-r--r-- | tests/defer_expected | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/defer.toc b/tests/defer.toc index 32165e7..6c2a304 100644 --- a/tests/defer.toc +++ b/tests/defer.toc @@ -10,9 +10,26 @@ same ::= fn(n : int) int { x } +thing1 ::= fn() (int, int) { + x := 5; + y := 6; + defer x += 1; + x, y +} + +thing2 ::= fn() x := 5, y := 6 { + defer x += 1; +} + main ::= fn() { io.puti(plusone(3)); io.puti(same(3)); + a, b := thing1(); + c, d := thing2(); + io.puti(a); + io.puti(b); + io.puti(c); + io.puti(d); defer io.puts("deferred from main()"); for i := 1..10 { defer io.puts("deferred from for"); diff --git a/tests/defer_expected b/tests/defer_expected index 99b45e1..e678115 100644 --- a/tests/defer_expected +++ b/tests/defer_expected @@ -1,5 +1,9 @@ 4 3 +5 +6 +6 +6 1 deferred from for 2 |