diff options
| author | Benoit Germain <bnt.germain@gmail.com> | 2013-01-10 06:16:36 -0800 |
|---|---|---|
| committer | Benoit Germain <bnt.germain@gmail.com> | 2013-01-10 06:16:36 -0800 |
| commit | da33bf20d6907a9f783e4a3015105a353d4d956e (patch) | |
| tree | 8f9770774a47c7347bed81cf4bbca225a196a406 /tests | |
| parent | 01fd6fd07cd0f9332dadbcc3fd9218c28a0527a1 (diff) | |
| download | lanes-da33bf20d6907a9f783e4a3015105a353d4d956e.tar.gz lanes-da33bf20d6907a9f783e4a3015105a353d4d956e.tar.bz2 lanes-da33bf20d6907a9f783e4a3015105a353d4d956e.zip | |
Create rupval.lua
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rupval.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/rupval.lua b/tests/rupval.lua new file mode 100644 index 0000000..7b5a270 --- /dev/null +++ b/tests/rupval.lua | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | lanes = require "lanes".configure{with_timers=false} | ||
| 2 | |||
| 3 | -- make sure we can copy functions with interdependant upvalues | ||
| 4 | |||
| 5 | local b | ||
| 6 | local a = function( n) | ||
| 7 | print( "a", n) | ||
| 8 | return n <= 0 and n or b( n-1) | ||
| 9 | end | ||
| 10 | |||
| 11 | local c | ||
| 12 | b = function( n) | ||
| 13 | print( "b", n) | ||
| 14 | return n <= 0 and n or c( n-1) | ||
| 15 | end | ||
| 16 | |||
| 17 | c = function( n) | ||
| 18 | print( "c", n) | ||
| 19 | return n <= 0 and n or a( n-1) | ||
| 20 | end | ||
| 21 | |||
| 22 | local g = lanes.gen( "*", a) | ||
| 23 | |||
| 24 | local l = g(10) | ||
| 25 | l:join() | ||
