diff options
Diffstat (limited to 'tests/nameof.lua')
-rw-r--r-- | tests/nameof.lua | 9 |
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 @@ | |||
1 | local lanes = require "lanes".configure{nb_user_keepers = 100, on_state_create = function() end} | 1 | local lanes = require "lanes".configure{nb_user_keepers = 100, on_state_create = function() end} |
2 | 2 | ||
3 | local SLEEP = function(...) | ||
4 | local k, v = lanes.sleep(...) | ||
5 | assert(k == nil and v == "timeout") | ||
6 | end | ||
7 | |||
3 | print("Name of table: ", lanes.nameof({})) | 8 | print("Name of table: ", lanes.nameof({})) |
4 | print("Name of string.sub: ", lanes.nameof(string.sub)) | 9 | print("Name of string.sub: ", lanes.nameof(string.sub)) |
5 | print("Name of print: ", lanes.nameof(print)) | 10 | print("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 |
16 | local h = lanes.gen(nil, body)() | 21 | local h = lanes.gen(nil, body)() |
17 | lanes.sleep(0.1) | 22 | SLEEP(0.1) |
18 | print("Name of lane: ", lanes.nameof(h), "("..h.status..")") | 23 | print("Name of lane: ", lanes.nameof(h), "("..h.status..")") |
19 | assert(h.status == "running") | 24 | assert(h.status == "running") |
20 | -- cancel the lane | 25 | -- cancel the lane |
21 | h:cancel("line", 1) | 26 | h:cancel("line", 1) |
22 | lanes.sleep(0.1) | 27 | SLEEP(0.1) |
23 | print("Name of lane: ", lanes.nameof(h), "("..h.status..")") | 28 | print("Name of lane: ", lanes.nameof(h), "("..h.status..")") |
24 | assert(h.status == "cancelled") | 29 | assert(h.status == "cancelled") |
25 | print "TEST OK" | 30 | print "TEST OK" |