aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-05-20 10:58:06 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-05-20 10:58:06 +0200
commit08040747494fe7839d2ab049e37f8e23fb8141b4 (patch)
tree62dbbc9227d61e7447ad66e377b5c544c3bf118d /tests
parent742cfdd2f9009ed12d7109e152df8c760851a58a (diff)
downloadlanes-08040747494fe7839d2ab049e37f8e23fb8141b4.tar.gz
lanes-08040747494fe7839d2ab049e37f8e23fb8141b4.tar.bz2
lanes-08040747494fe7839d2ab049e37f8e23fb8141b4.zip
linda:limit errors on limits < 1
Diffstat (limited to '')
-rw-r--r--tests/basic.lua3
-rw-r--r--tests/errhangtest.lua5
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index 85a9889..68a7e2a 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -155,7 +155,8 @@ assert(st == "cancelled")
155 155
156-- cancellation of lanes waiting on a linda 156-- cancellation of lanes waiting on a linda
157local limited = lanes.linda("limited") 157local limited = lanes.linda("limited")
158limited:limit("key", 1) 158assert.fails(function() limited:limit("key", 0) end)
159assert.failsnot(function() limited:limit("key", 1) end)
159-- [[################################################ 160-- [[################################################
160limited:send("key", "hello") -- saturate linda 161limited:send("key", "hello") -- saturate linda
161for k, v in pairs(limited:dump()) do 162for k, v in pairs(limited:dump()) do
diff --git a/tests/errhangtest.lua b/tests/errhangtest.lua
index 811601e..84de8c6 100644
--- a/tests/errhangtest.lua
+++ b/tests/errhangtest.lua
@@ -39,7 +39,10 @@ if true then
39 print(pcall(linda.send, linda, 'test', t_in)) 39 print(pcall(linda.send, linda, 'test', t_in))
40 local k,t_out = linda:receive('test') -- read the contents successfully sent 40 local k,t_out = linda:receive('test') -- read the contents successfully sent
41 t_out.fun() 41 t_out.fun()
42 -- TODO: t_out should contain a single entry, as [fun] = fun should have been discarded because functions are not acceptable keys 42 -- t_out should contain a single entry, as [fun] = fun should have been discarded because functions are not acceptable keys
43 local count = 0
44 for k,v in pairs(t_out) do count = count + 1 end
45 assert(count == 1)
43 print "OK" 46 print "OK"
44end 47end
45 48