aboutsummaryrefslogtreecommitdiff
path: root/tests/units/closure-copy.lua
diff options
context:
space:
mode:
authorame <[email protected]>2026-01-14 00:01:14 -0600
committerame <[email protected]>2026-01-14 00:06:40 -0600
commit9a67405a0983a779fec7328a0767c4d7561c08ea (patch)
treebac59ad1358d7456155cc6b14c4578084fef7ded /tests/units/closure-copy.lua
parent8fe66fe2ae75121a6fa6909c04fa5c3cb11cd09c (diff)
fix closures when cloned
Diffstat (limited to 'tests/units/closure-copy.lua')
-rw-r--r--tests/units/closure-copy.lua16
1 files changed, 16 insertions, 0 deletions
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