diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 16:48:48 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 16:48:48 +0200 |
commit | e3f3288597dc62c9c26d89f92e396bc3abf4b408 (patch) | |
tree | 250beb191624642ffbecbcc8848c4c7b575420e3 /tests | |
parent | 4d364d3e77667b70bf3261da004f4990ef0c3ada (diff) | |
download | lanes-e3f3288597dc62c9c26d89f92e396bc3abf4b408.tar.gz lanes-e3f3288597dc62c9c26d89f92e396bc3abf4b408.tar.bz2 lanes-e3f3288597dc62c9c26d89f92e396bc3abf4b408.zip |
Fix error handling when indexing a lane with unexpected data
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/basic.lua b/tests/basic.lua index ae8ebd9..6282e3e 100644 --- a/tests/basic.lua +++ b/tests/basic.lua | |||
@@ -92,6 +92,8 @@ local task_launch= lanes_gen("", { globals={hey=true}, gc_cb = gc_cb}, task) | |||
92 | -- 'task_launch' is a factory of multithreaded tasks, we can launch several: | 92 | -- 'task_launch' is a factory of multithreaded tasks, we can launch several: |
93 | 93 | ||
94 | local lane1= task_launch(100,200,3) | 94 | local lane1= task_launch(100,200,3) |
95 | assert.fails(function() print(lane1[lane1]) end) -- indexing the lane with anything other than a string or a number should fail | ||
96 | |||
95 | local lane2= task_launch(200,300,4) | 97 | local lane2= task_launch(200,300,4) |
96 | 98 | ||
97 | -- At this stage, states may be "pending", "running" or "done" | 99 | -- At this stage, states may be "pending", "running" or "done" |
@@ -435,7 +437,7 @@ local function chunk2(linda) | |||
435 | assert(config.strip_functions and info.short_src=="?" or string.match(info.short_src, "^.*basic.lua$"), "bad info.short_src") | 437 | assert(config.strip_functions and info.short_src=="?" or string.match(info.short_src, "^.*basic.lua$"), "bad info.short_src") |
436 | -- These vary so let's not be picky (they're there..) | 438 | -- These vary so let's not be picky (they're there..) |
437 | -- | 439 | -- |
438 | assert(info.linedefined == 420, "bad linedefined") -- start of 'chunk2' | 440 | assert(info.linedefined == 422, "bad linedefined") -- start of 'chunk2' |
439 | assert(config.strip_functions and info.currentline==-1 or info.currentline > info.linedefined, "bad currentline") -- line of 'debug.getinfo' | 441 | assert(config.strip_functions and info.currentline==-1 or info.currentline > info.linedefined, "bad currentline") -- line of 'debug.getinfo' |
440 | assert(info.lastlinedefined > info.currentline, "bad lastlinedefined") -- end of 'chunk2' | 442 | assert(info.lastlinedefined > info.currentline, "bad lastlinedefined") -- end of 'chunk2' |
441 | local k,func= linda:receive("down") | 443 | local k,func= linda:receive("down") |