diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-11 15:56:04 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-11 15:56:04 +0200 |
| commit | 00970610dc8fbd00a11d3b69e4702933a592ce9f (patch) | |
| tree | c746e91de27fe7ce036242e4667074b4597b77dd /tests | |
| parent | 21e881fd6c085e615c438ceb6eb438712f5c5075 (diff) | |
| parent | adaa36dbec1ce9aaafd61873b9d3d898a8c240cf (diff) | |
| download | lanes-00970610dc8fbd00a11d3b69e4702933a592ce9f.tar.gz lanes-00970610dc8fbd00a11d3b69e4702933a592ce9f.tar.bz2 lanes-00970610dc8fbd00a11d3b69e4702933a592ce9f.zip | |
Merge branch 'C-Implementation'
Since almost everything in C-implementation comes from manual cherry-picking stuff in master, the merge essentially consist in a pure git tree operation to reconnect stuff properly.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/errhangtest.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/errhangtest.lua b/tests/errhangtest.lua index 7286fa5..d26dcef 100644 --- a/tests/errhangtest.lua +++ b/tests/errhangtest.lua | |||
| @@ -4,10 +4,19 @@ local linda = lanes.linda() | |||
| 4 | 4 | ||
| 5 | local coro = coroutine.create(function() end) | 5 | local coro = coroutine.create(function() end) |
| 6 | 6 | ||
| 7 | local fun = function() print "fun" end | ||
| 8 | local t_in = { [fun] = fun, fun = fun } | ||
| 9 | |||
| 10 | -- send a string | ||
| 11 | print( pcall(linda.send,linda, 'test', "oh boy")) | ||
| 12 | -- send a table that contains a function | ||
| 13 | print( pcall(linda.send,linda, 'test', t_in)) | ||
| 7 | -- we are not allowed to send coroutines through a lanes | 14 | -- we are not allowed to send coroutines through a lanes |
| 8 | -- however, this should raise an error, not hang the program... | 15 | -- however, this should raise an error, not hang the program... |
| 9 | print( pcall(linda.send,linda, 'test', "oh boy")) | ||
| 10 | print( pcall(linda.send,linda, 'test', coro)) | 16 | print( pcall(linda.send,linda, 'test', coro)) |
| 11 | k,res = linda:receive('test') | 17 | k,str = linda:receive('test') -- read the contents successfully sent |
| 12 | print( res) | 18 | print( str) -- "oh boy" |
| 19 | k,t_out = linda:receive('test') -- read the contents successfully sent | ||
| 20 | t_out.fun() -- "fun" | ||
| 13 | -- linda:send( 'test', coro) | 21 | -- linda:send( 'test', coro) |
| 22 | print "SUCCESS" \ No newline at end of file | ||
