From 08040747494fe7839d2ab049e37f8e23fb8141b4 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 20 May 2024 10:58:06 +0200 Subject: linda:limit errors on limits < 1 --- tests/basic.lua | 3 ++- tests/errhangtest.lua | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') 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") -- cancellation of lanes waiting on a linda local limited = lanes.linda("limited") -limited:limit("key", 1) +assert.fails(function() limited:limit("key", 0) end) +assert.failsnot(function() limited:limit("key", 1) end) -- [[################################################ limited:send("key", "hello") -- saturate linda for 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 print(pcall(linda.send, linda, 'test', t_in)) local k,t_out = linda:receive('test') -- read the contents successfully sent t_out.fun() - -- TODO: t_out should contain a single entry, as [fun] = fun should have been discarded because functions are not acceptable keys + -- t_out should contain a single entry, as [fun] = fun should have been discarded because functions are not acceptable keys + local count = 0 + for k,v in pairs(t_out) do count = count + 1 end + assert(count == 1) print "OK" end -- cgit v1.2.3-55-g6feb