diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-27 14:47:56 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-27 14:47:56 +0200 |
commit | b482ed9c30cddac31dcff2d19e517bf20af30d10 (patch) | |
tree | b65f7b2f0a841484e262f5e6396419f7587d76da /tests | |
parent | 82ec0e4de089074aae26ab72040523fa7d21557d (diff) | |
download | lanes-b482ed9c30cddac31dcff2d19e517bf20af30d10.tar.gz lanes-b482ed9c30cddac31dcff2d19e517bf20af30d10.tar.bz2 lanes-b482ed9c30cddac31dcff2d19e517bf20af30d10.zip |
More string_view
Diffstat (limited to 'tests')
-rw-r--r-- | tests/nameof.lua | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/nameof.lua b/tests/nameof.lua index 221c893..79d5760 100644 --- a/tests/nameof.lua +++ b/tests/nameof.lua | |||
@@ -1,5 +1,25 @@ | |||
1 | lanes = require "lanes".configure() | 1 | local lanes = require "lanes".configure() |
2 | 2 | ||
3 | print( lanes.nameof( {})) | 3 | print("Name of table: ", lanes.nameof({})) |
4 | print( lanes.nameof( string.sub)) | 4 | print("Name of string.sub: ", lanes.nameof(string.sub)) |
5 | print( lanes.nameof( print)) | 5 | print("Name of print: ", lanes.nameof(print)) |
6 | |||
7 | -- a standalone function without any dependency | ||
8 | local body = function() | ||
9 | local n = 0 | ||
10 | for i = 1, 1e30 do | ||
11 | n = n + 1 | ||
12 | end | ||
13 | end | ||
14 | |||
15 | -- start the lane without any library | ||
16 | local h = lanes.gen(nil, body)() | ||
17 | lanes.sleep(0.1) | ||
18 | print("Name of lane: ", lanes.nameof(h), "("..h.status..")") | ||
19 | assert(h.status == "running") | ||
20 | -- cancel the lane | ||
21 | h:cancel("line", 1) | ||
22 | lanes.sleep(0.1) | ||
23 | print("Name of lane: ", lanes.nameof(h), "("..h.status..")") | ||
24 | assert(h.status == "cancelled") | ||
25 | print "TEST OK" \ No newline at end of file | ||