aboutsummaryrefslogtreecommitdiff
path: root/unit_tests/scripts/lane/tasking_basic.lua
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-06-23 09:08:25 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2025-06-23 09:08:25 +0200
commit8d1a16c36ffd64638e6c3cc8a47b5c56017cdc9f (patch)
tree73d3ca2f6c5da4a075872228e91d663a7c4dc02e /unit_tests/scripts/lane/tasking_basic.lua
parentbfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8 (diff)
downloadlanes-8d1a16c36ffd64638e6c3cc8a47b5c56017cdc9f.tar.gz
lanes-8d1a16c36ffd64638e6c3cc8a47b5c56017cdc9f.tar.bz2
lanes-8d1a16c36ffd64638e6c3cc8a47b5c56017cdc9f.zip
Added 2 tests in tasking_basic
Diffstat (limited to 'unit_tests/scripts/lane/tasking_basic.lua')
-rw-r--r--unit_tests/scripts/lane/tasking_basic.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/unit_tests/scripts/lane/tasking_basic.lua b/unit_tests/scripts/lane/tasking_basic.lua
index 233accf..7a22307 100644
--- a/unit_tests/scripts/lane/tasking_basic.lua
+++ b/unit_tests/scripts/lane/tasking_basic.lua
@@ -15,6 +15,33 @@ local lanes_linda = assert(lanes.linda)
15-- ################################################################################################## 15-- ##################################################################################################
16-- ################################################################################################## 16-- ##################################################################################################
17 17
18-- we can create a generator where the lane body is a C function
19do
20 local b, g = pcall(lanes.gen, "*", print)
21 assert(b == true and type(g) == "function")
22 -- we can start the lane
23 local b, h = pcall(g, "hello")
24 -- the lane runs normally
25 h:join()
26 assert(h.status == "done")
27end
28
29-- we can create a generator where the lane body is a C function that raises an error
30do
31 local b, g = pcall(lanes.gen, "*", error)
32 assert(b == true and type(g) == "function")
33 -- we can start the lane
34 local b, h = pcall(g, "this is an error")
35 -- this provides the error that occurred in the lane
36 local s, e, t = h:join()
37 assert(h.status == "error")
38 assert(s == nil and e == "this is an error" and t == nil)
39end
40
41-- ##################################################################################################
42-- ##################################################################################################
43-- ##################################################################################################
44
18local function task(a, b, c) 45local function task(a, b, c)
19 local new_name = "task("..a..","..b..","..c..")" 46 local new_name = "task("..a..","..b..","..c..")"
20 -- test lane naming change 47 -- test lane naming change