aboutsummaryrefslogtreecommitdiff
path: root/unit_tests/scripts/linda/send_receive_func_and_string.lua
diff options
context:
space:
mode:
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)