aboutsummaryrefslogtreecommitdiff
path: root/unit_tests/scripts/linda/send_receive_func_and_string.lua
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2025-07-24 16:51:49 +0200
committerBenoit Germain <bnt.germain@gmail.com>2025-07-24 16:51:49 +0200
commitd8acb18ce8bf6e89a042d166f61b2934e8722cf0 (patch)
tree69f5046056f4aa38b868b057055da8144e029846 /unit_tests/scripts/linda/send_receive_func_and_string.lua
parenteb997664a5a0a7890efa050982854a1447aec70f (diff)
downloadlanes-d8acb18ce8bf6e89a042d166f61b2934e8722cf0.tar.gz
lanes-d8acb18ce8bf6e89a042d166f61b2934e8722cf0.tar.bz2
lanes-d8acb18ce8bf6e89a042d166f61b2934e8722cf0.zip
Rework function bytecode dumping to be Lua5.5-ready
* prepare the luaL_Buffer in the destination state instead of the source state to prevent stack issues when everything happens in the same state
Diffstat (limited to 'unit_tests/scripts/linda/send_receive_func_and_string.lua')
-rw-r--r--unit_tests/scripts/linda/send_receive_func_and_string.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/unit_tests/scripts/linda/send_receive_func_and_string.lua b/unit_tests/scripts/linda/send_receive_func_and_string.lua
new file mode 100644
index 0000000..188cfcd
--- /dev/null
+++ b/unit_tests/scripts/linda/send_receive_func_and_string.lua
@@ -0,0 +1,13 @@
1local lanes = require "lanes"
2
3-- a newly created linda doesn't contain anything
4local l = lanes.linda()
5
6-- send a function and a string, make sure that's what we read back
7l:send("k", function() end, "str")
8local c = l:count("k")
9assert(c == 2, "got " .. c)
10local k, v1, v2 = l:receive_batched("k", 2)
11local tv1, tv2 = type(v1), type(v2)
12assert(k == "k" and tv1 == "function" and tv2 == "string", "got " .. tv1 .. " " .. tv2)
13assert(l:count("k") == 0)