aboutsummaryrefslogtreecommitdiff
path: root/tests/nameof.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/nameof.lua')
-rw-r--r--tests/nameof.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/nameof.lua b/tests/nameof.lua
index 58df3e2..f48a971 100644
--- a/tests/nameof.lua
+++ b/tests/nameof.lua
@@ -1,5 +1,10 @@
1local lanes = require "lanes".configure{nb_user_keepers = 100, on_state_create = function() end} 1local lanes = require "lanes".configure{nb_user_keepers = 100, on_state_create = function() end}
2 2
3local SLEEP = function(...)
4 local k, v = lanes.sleep(...)
5 assert(k == nil and v == "timeout")
6end
7
3print("Name of table: ", lanes.nameof({})) 8print("Name of table: ", lanes.nameof({}))
4print("Name of string.sub: ", lanes.nameof(string.sub)) 9print("Name of string.sub: ", lanes.nameof(string.sub))
5print("Name of print: ", lanes.nameof(print)) 10print("Name of print: ", lanes.nameof(print))
@@ -14,12 +19,12 @@ end
14 19
15-- start the lane without any library 20-- start the lane without any library
16local h = lanes.gen(nil, body)() 21local h = lanes.gen(nil, body)()
17lanes.sleep(0.1) 22SLEEP(0.1)
18print("Name of lane: ", lanes.nameof(h), "("..h.status..")") 23print("Name of lane: ", lanes.nameof(h), "("..h.status..")")
19assert(h.status == "running") 24assert(h.status == "running")
20-- cancel the lane 25-- cancel the lane
21h:cancel("line", 1) 26h:cancel("line", 1)
22lanes.sleep(0.1) 27SLEEP(0.1)
23print("Name of lane: ", lanes.nameof(h), "("..h.status..")") 28print("Name of lane: ", lanes.nameof(h), "("..h.status..")")
24assert(h.status == "cancelled") 29assert(h.status == "cancelled")
25print "TEST OK" 30print "TEST OK"