From bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Thu, 5 Jun 2025 16:03:22 +0200 Subject: 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 --- tests/func_is_string.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/func_is_string.lua') diff --git a/tests/func_is_string.lua b/tests/func_is_string.lua index 5de4c60..3c91603 100644 --- a/tests/func_is_string.lua +++ b/tests/func_is_string.lua @@ -21,16 +21,17 @@ end local options = {globals = { b = 666 }} -local gen1 = lanes.gen("*", { name = 'auto' }, "return true, dofile('fibonacci.lua')") -local gen2 = lanes.gen(options, { name = 'auto' }, "return b") +local gen1 = lanes.gen("*", { name = 'auto' }, "return true, error('bob')") fibLane = gen1() lanes.sleep(0.1) print(fibLane, fibLane.status) -local _status, _err = fibLane:join() -print(_status, _err) +local _r, _err, _stk = fibLane:join() +assert(_r == nil, "got " .. tostring(_r) .. " " .. tostring(_err) .. " " .. tostring(_stk)) -retLane1, retLane2 = gen2(), gen2() +local gen2 = lanes.gen(options, { name = 'auto' }, "return b") +local retLane1, retLane2 = gen2(), gen2() print( retLane1[1], retLane2[1]) -print "TEST OK" \ No newline at end of file +assert(retLane1[1] == 666 and retLane2[1] == 666) +print "TEST OK" -- cgit v1.2.3-55-g6feb