diff options
| -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() | ||
