diff options
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.lua | 13 |
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 @@ | |||
1 | local lanes = require "lanes" | ||
2 | |||
3 | -- a newly created linda doesn't contain anything | ||
4 | local l = lanes.linda() | ||
5 | |||
6 | -- send a function and a string, make sure that's what we read back | ||
7 | l:send("k", function() end, "str") | ||
8 | local c = l:count("k") | ||
9 | assert(c == 2, "got " .. c) | ||
10 | local k, v1, v2 = l:receive_batched("k", 2) | ||
11 | local tv1, tv2 = type(v1), type(v2) | ||
12 | assert(k == "k" and tv1 == "function" and tv2 == "string", "got " .. tv1 .. " " .. tv2) | ||
13 | assert(l:count("k") == 0) | ||