From c360af2df3e0904c7338cc1f32fcb270b7e34092 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Tue, 4 Jun 2024 16:19:47 +0200 Subject: Refactored keeper implementation of linda:receive() --- tests/basic.lua | 2 +- tests/errhangtest.lua | 9 ++++++++- tests/linda_perf.lua | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/basic.lua b/tests/basic.lua index ecd93fc..8522895 100644 --- a/tests/basic.lua +++ b/tests/basic.lua @@ -433,7 +433,7 @@ local function chunk2(linda) assert(config.strip_functions and info.short_src=="?" or string.match(info.short_src, "^.*basic.lua$"), "bad info.short_src") -- These vary so let's not be picky (they're there..) -- - assert(info.linedefined == 400, "bad linedefined") -- start of 'chunk2' + assert(info.linedefined == 419, "bad linedefined") -- start of 'chunk2' assert(config.strip_functions and info.currentline==-1 or info.currentline > info.linedefined, "bad currentline") -- line of 'debug.getinfo' assert(info.lastlinedefined > info.currentline, "bad lastlinedefined") -- end of 'chunk2' local k,func= linda:receive("down") diff --git a/tests/errhangtest.lua b/tests/errhangtest.lua index 99f44b2..d0ffcc4 100644 --- a/tests/errhangtest.lua +++ b/tests/errhangtest.lua @@ -1,4 +1,8 @@ -local lanes = require "lanes".configure{with_timers=false} +local lanes = require "lanes".configure{with_timers=false,strip_functions=false} + +local require_assert_result_1, require_assert_result_2 = require "assert" -- assert.fails() +print("require_assert_result:", require_assert_result_1, require_assert_result_2) + local linda = lanes.linda() -- we are not allowed to send coroutines through a lane @@ -22,6 +26,9 @@ end -- get/set a few values if true then print "\n#### set 3 -> receive batched" + assert.fails(function() linda:receive(linda.batched, "some key", -1, 1) end) + assert.fails(function() linda:receive(linda.batched, "some key", 2, 1) end) + assert.failsnot(function() linda:receive(0, linda.batched, "some key", 1, 3) end) local fun = function() print "function test ok" end print(pcall(linda.set, linda, 'test', true, nil, fun)) -- read back the contents diff --git a/tests/linda_perf.lua b/tests/linda_perf.lua index 4d35380..b173d12 100644 --- a/tests/linda_perf.lua +++ b/tests/linda_perf.lua @@ -124,7 +124,6 @@ do end end -do return end -- ################################################################################################# TEST1 = TEST1 or 1000 -- cgit v1.2.3-55-g6feb