aboutsummaryrefslogtreecommitdiff
path: root/tests/basic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basic.lua')
-rw-r--r--tests/basic.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index ab8a080..da7d756 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -29,6 +29,11 @@ local function PRINT(...)
29 end 29 end
30end 30end
31 31
32local SLEEP = function(...)
33 local k, v = lanes.sleep(...)
34 assert(k == nil and v == "timeout")
35end
36
32local gc_cb = function(name_, status_) 37local gc_cb = function(name_, status_)
33 PRINT(" ---> lane '" .. name_ .. "' collected with status '" .. status_ .. "'") 38 PRINT(" ---> lane '" .. name_ .. "' collected with status '" .. status_ .. "'")
34end 39end
@@ -256,7 +261,7 @@ SEND(3); WR("main ", "3 sent\n")
256SEND(setmetatable({"should be ignored"},{__lanesignore=true})); WR("main ", "__lanesignore table sent\n") 261SEND(setmetatable({"should be ignored"},{__lanesignore=true})); WR("main ", "__lanesignore table sent\n")
257for i=1,100 do 262for i=1,100 do
258 WR "." 263 WR "."
259 lanes.sleep(0.0001) 264 SLEEP(0.0001)
260 assert(PEEK() == nil) -- nothing coming in, yet 265 assert(PEEK() == nil) -- nothing coming in, yet
261end 266end
262SEND(nil); WR("\nmain ", "nil sent\n") 267SEND(nil); WR("\nmain ", "nil sent\n")
@@ -293,7 +298,7 @@ comms_lane = nil
293collectgarbage() 298collectgarbage()
294-- wait 299-- wait
295WR("waiting 1s") 300WR("waiting 1s")
296lanes.sleep(1) 301SLEEP(1)
297 302
298-- ################################################################################################## 303-- ##################################################################################################
299-- ################################################################################################## 304-- ##################################################################################################
@@ -470,7 +475,7 @@ end)
470 475
471h= S { 12, 13, 14 } -- execution starts, h[1..3] will get the return values 476h= S { 12, 13, 14 } -- execution starts, h[1..3] will get the return values
472-- wait a bit so that the lane has a chance to set its debug name 477-- wait a bit so that the lane has a chance to set its debug name
473lanes.sleep(0.5) 478SLEEP(0.5)
474print("joining with '" .. h:get_debug_threadname() .. "'") 479print("joining with '" .. h:get_debug_threadname() .. "'")
475local a,b,c,d= h:join() 480local a,b,c,d= h:join()
476if h.status == "error" then 481if h.status == "error" then