diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-06-05 16:03:22 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-06-05 16:03:22 +0200 |
| commit | bfdc7a92c4e3e99522abb6d90ef2cbb021f36fc8 (patch) | |
| tree | 00f6633878b21dda6cad1177d5619a501b4ac0a4 /tests/func_is_string.lua | |
| parent | f73702bcf4372a149b8b01a512c0e086b1e679e2 (diff) | |
| download | lanes-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/func_is_string.lua')
| -rw-r--r-- | tests/func_is_string.lua | 13 |
1 files changed, 7 insertions, 6 deletions
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 | |||
| 21 | 21 | ||
| 22 | local options = {globals = { b = 666 }} | 22 | local options = {globals = { b = 666 }} |
| 23 | 23 | ||
| 24 | local gen1 = lanes.gen("*", { name = 'auto' }, "return true, dofile('fibonacci.lua')") | 24 | local gen1 = lanes.gen("*", { name = 'auto' }, "return true, error('bob')") |
| 25 | local gen2 = lanes.gen(options, { name = 'auto' }, "return b") | ||
| 26 | 25 | ||
| 27 | fibLane = gen1() | 26 | fibLane = gen1() |
| 28 | lanes.sleep(0.1) | 27 | lanes.sleep(0.1) |
| 29 | print(fibLane, fibLane.status) | 28 | print(fibLane, fibLane.status) |
| 30 | local _status, _err = fibLane:join() | 29 | local _r, _err, _stk = fibLane:join() |
| 31 | print(_status, _err) | 30 | assert(_r == nil, "got " .. tostring(_r) .. " " .. tostring(_err) .. " " .. tostring(_stk)) |
| 32 | 31 | ||
| 33 | retLane1, retLane2 = gen2(), gen2() | 32 | local gen2 = lanes.gen(options, { name = 'auto' }, "return b") |
| 33 | local retLane1, retLane2 = gen2(), gen2() | ||
| 34 | 34 | ||
| 35 | print( retLane1[1], retLane2[1]) | 35 | print( retLane1[1], retLane2[1]) |
| 36 | print "TEST OK" \ No newline at end of file | 36 | assert(retLane1[1] == 666 and retLane2[1] == 666) |
| 37 | print "TEST OK" | ||
