diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-04 16:19:47 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-04 16:19:47 +0200 |
commit | c360af2df3e0904c7338cc1f32fcb270b7e34092 (patch) | |
tree | 22b27902eff9148e787c968f5bd60ad44252c3a3 /tests | |
parent | 4695cbe96514e6b174fb5050bb2e9a41514091f3 (diff) | |
download | lanes-c360af2df3e0904c7338cc1f32fcb270b7e34092.tar.gz lanes-c360af2df3e0904c7338cc1f32fcb270b7e34092.tar.bz2 lanes-c360af2df3e0904c7338cc1f32fcb270b7e34092.zip |
Refactored keeper implementation of linda:receive()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic.lua | 2 | ||||
-rw-r--r-- | tests/errhangtest.lua | 9 | ||||
-rw-r--r-- | tests/linda_perf.lua | 1 |
3 files changed, 9 insertions, 3 deletions
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) | |||
433 | assert(config.strip_functions and info.short_src=="?" or string.match(info.short_src, "^.*basic.lua$"), "bad info.short_src") | 433 | assert(config.strip_functions and info.short_src=="?" or string.match(info.short_src, "^.*basic.lua$"), "bad info.short_src") |
434 | -- These vary so let's not be picky (they're there..) | 434 | -- These vary so let's not be picky (they're there..) |
435 | -- | 435 | -- |
436 | assert(info.linedefined == 400, "bad linedefined") -- start of 'chunk2' | 436 | assert(info.linedefined == 419, "bad linedefined") -- start of 'chunk2' |
437 | assert(config.strip_functions and info.currentline==-1 or info.currentline > info.linedefined, "bad currentline") -- line of 'debug.getinfo' | 437 | assert(config.strip_functions and info.currentline==-1 or info.currentline > info.linedefined, "bad currentline") -- line of 'debug.getinfo' |
438 | assert(info.lastlinedefined > info.currentline, "bad lastlinedefined") -- end of 'chunk2' | 438 | assert(info.lastlinedefined > info.currentline, "bad lastlinedefined") -- end of 'chunk2' |
439 | local k,func= linda:receive("down") | 439 | 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 @@ | |||
1 | local lanes = require "lanes".configure{with_timers=false} | 1 | local lanes = require "lanes".configure{with_timers=false,strip_functions=false} |
2 | |||
3 | local require_assert_result_1, require_assert_result_2 = require "assert" -- assert.fails() | ||
4 | print("require_assert_result:", require_assert_result_1, require_assert_result_2) | ||
5 | |||
2 | local linda = lanes.linda() | 6 | local linda = lanes.linda() |
3 | 7 | ||
4 | -- we are not allowed to send coroutines through a lane | 8 | -- we are not allowed to send coroutines through a lane |
@@ -22,6 +26,9 @@ end | |||
22 | -- get/set a few values | 26 | -- get/set a few values |
23 | if true then | 27 | if true then |
24 | print "\n#### set 3 -> receive batched" | 28 | print "\n#### set 3 -> receive batched" |
29 | assert.fails(function() linda:receive(linda.batched, "some key", -1, 1) end) | ||
30 | assert.fails(function() linda:receive(linda.batched, "some key", 2, 1) end) | ||
31 | assert.failsnot(function() linda:receive(0, linda.batched, "some key", 1, 3) end) | ||
25 | local fun = function() print "function test ok" end | 32 | local fun = function() print "function test ok" end |
26 | print(pcall(linda.set, linda, 'test', true, nil, fun)) | 33 | print(pcall(linda.set, linda, 'test', true, nil, fun)) |
27 | -- read back the contents | 34 | -- 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 | |||
124 | end | 124 | end |
125 | end | 125 | end |
126 | 126 | ||
127 | do return end | ||
128 | -- ################################################################################################# | 127 | -- ################################################################################################# |
129 | 128 | ||
130 | TEST1 = TEST1 or 1000 | 129 | TEST1 = TEST1 or 1000 |