aboutsummaryrefslogtreecommitdiff
path: root/tests/errhangtest.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errhangtest.lua')
-rw-r--r--tests/errhangtest.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/errhangtest.lua b/tests/errhangtest.lua
index d0ffcc4..fff0dee 100644
--- a/tests/errhangtest.lua
+++ b/tests/errhangtest.lua
@@ -11,7 +11,8 @@ if true then
11 print "#### coro set" 11 print "#### coro set"
12 local coro = coroutine.create(function() end) 12 local coro = coroutine.create(function() end)
13 print(pcall(linda.set, linda, 'test', coro)) 13 print(pcall(linda.set, linda, 'test', coro))
14 assert(linda:get("test") == nil) 14 local _count, _val = linda:get("test")
15 assert(_count == 0 and _val == nil)
15 print "OK" 16 print "OK"
16end 17end
17 18
@@ -19,7 +20,8 @@ if true then
19 print "\n#### reserved sentinels" 20 print "\n#### reserved sentinels"
20 print(pcall(linda.set, linda, lanes.cancel_error)) 21 print(pcall(linda.set, linda, lanes.cancel_error))
21 print(pcall(linda.set, linda, linda.batched)) 22 print(pcall(linda.set, linda, linda.batched))
22 assert(linda:get("test") == nil) 23 local _count, _val = linda:get("test")
24 assert(_count == 0 and _val == nil)
23 print "OK" 25 print "OK"
24end 26end
25 27
@@ -33,7 +35,8 @@ if true then
33 print(pcall(linda.set, linda, 'test', true, nil, fun)) 35 print(pcall(linda.set, linda, 'test', true, nil, fun))
34 -- read back the contents 36 -- read back the contents
35 local k,b,n,f = linda:receive(linda.batched, 'test', 3) 37 local k,b,n,f = linda:receive(linda.batched, 'test', 3)
36 assert(linda:get("test") == nil) 38 local _count, _val = linda:get("test")
39 assert(_count == 0 and _val == nil)
37 -- check they are ok 40 -- check they are ok
38 print(k, b, n) 41 print(k, b, n)
39 f() 42 f()
@@ -70,7 +73,8 @@ if true then
70 print "\n#### coro send" 73 print "\n#### coro send"
71 local coro = coroutine.create(function() end) 74 local coro = coroutine.create(function() end)
72 print(pcall(linda.send, linda, 'test', coro)) 75 print(pcall(linda.send, linda, 'test', coro))
73 assert(linda:get("test") == nil) 76 local _count, _val = linda:get("test")
77 assert(_count == 0 and _val == nil)
74 print "OK" 78 print "OK"
75end 79end
76 80