diff options
| author | ame <[email protected]> | 2026-01-14 00:01:14 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2026-01-14 00:06:40 -0600 |
| commit | 9a67405a0983a779fec7328a0767c4d7561c08ea (patch) | |
| tree | bac59ad1358d7456155cc6b14c4578084fef7ded /tests | |
| parent | 8fe66fe2ae75121a6fa6909c04fa5c3cb11cd09c (diff) | |
fix closures when cloned
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tests.lua | 2 | ||||
| -rw-r--r-- | tests/units/closure-copy.lua | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/tests.lua b/tests/tests.lua index c95e072..f605bd0 100644 --- a/tests/tests.lua +++ b/tests/tests.lua @@ -21,7 +21,7 @@ local handle = assert(io.popen("find tests/units/".. search .." -type f")) for file in handle:lines() do total = total + 1 - print(file) + print(file .. " ...") local f = loadfile(file)() --move up one line and clear it diff --git a/tests/units/closure-copy.lua b/tests/units/closure-copy.lua new file mode 100644 index 0000000..23cbc07 --- /dev/null +++ b/tests/units/closure-copy.lua @@ -0,0 +1,16 @@ +local A = 298 +local B = 3428 +local C = 438 +local D = 4444 +local function outer(a, b) + local c = C + return function(d) + return a + b * c + d + end +end + +local val = llby.thread.async(function(res) + res(outer(A, B)(D)) +end):await() + +return val == A + B * C + D |
