aboutsummaryrefslogtreecommitdiff
path: root/tests/errhangtest.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/errhangtest.lua15
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
5local coro = coroutine.create(function() end) 5local coro = coroutine.create(function() end)
6 6
7local fun = function() print "fun" end
8local t_in = { [fun] = fun, fun = fun }
9
10-- send a string
11print( pcall(linda.send,linda, 'test', "oh boy"))
12-- send a table that contains a function
13print( 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...
9print( pcall(linda.send,linda, 'test', "oh boy"))
10print( pcall(linda.send,linda, 'test', coro)) 16print( pcall(linda.send,linda, 'test', coro))
11k,res = linda:receive('test') 17k,str = linda:receive('test') -- read the contents successfully sent
12print( res) 18print( str) -- "oh boy"
19k,t_out = linda:receive('test') -- read the contents successfully sent
20t_out.fun() -- "fun"
13-- linda:send( 'test', coro) 21-- linda:send( 'test', coro)
22print "SUCCESS" \ No newline at end of file