aboutsummaryrefslogtreecommitdiff
path: root/tests/basic.lua
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-06-05 16:03:22 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2025-06-05 16:03:22 +0200
commitbfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8 (patch)
tree00f6633878b21dda6cad1177d5619a501b4ac0a4 /tests/basic.lua
parentf73702bcf4372a149b8b01a512c0e086b1e679e2 (diff)
downloadlanes-bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8.tar.gz
lanes-bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8.tar.bz2
lanes-bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8.zip
Change lane:join() return values
* when no error is raised in the lane, lane:join() now precedes the lane returned values with true * lane body is no longer forced to return something when used with join() * adjusted all relevant unit tests accordingly
Diffstat (limited to 'tests/basic.lua')
-rw-r--r--tests/basic.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index 9aaad97..f393175 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -507,19 +507,20 @@ local S = lanes.gen("table", { name = 'auto', gc_cb = gc_cb },
507 return (unpack or table.unpack)(aux) 507 return (unpack or table.unpack)(aux)
508end) 508end)
509 509
510h= S { 12, 13, 14 } -- execution starts, h[1..3] will get the return values 510h = S { 12, 13, 14 } -- execution starts, h[1..3] will get the return values
511-- wait a bit so that the lane has a chance to set its debug name 511-- wait a bit so that the lane has a chance to set its debug name
512SLEEP(0.5) 512SLEEP(0.5)
513print("joining with '" .. h:get_threadname() .. "'") 513print("joining with '" .. h:get_threadname() .. "'")
514local a,b,c,d= h:join() 514local r,a,b,c,d= h:join()
515if h.status == "error" then 515if h.status == "error" then
516 print(h:get_threadname(), "error: " , a, b, c, d) 516 print(h:get_threadname(), "error: " , r, a, b, c, d)
517else 517else
518 print(h:get_threadname(), a,b,c,d) 518 print(h:get_threadname(), r,a,b,c,d)
519 assert(a==14) 519 assert(r == true)
520 assert(b==13) 520 assert(a == 14)
521 assert(c==12) 521 assert(b == 13)
522 assert(d==nil) 522 assert(c == 12)
523 assert(d == nil)
523end 524end
524 525
525local nameof_type, nameof_name = lanes.nameof(print) 526local nameof_type, nameof_name = lanes.nameof(print)