aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.lua2
-rw-r--r--tests/units/closure-copy.lua16
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