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/basic.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/basic.lua')
| -rw-r--r-- | tests/basic.lua | 17 |
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) |
| 508 | end) | 508 | end) |
| 509 | 509 | ||
| 510 | h= S { 12, 13, 14 } -- execution starts, h[1..3] will get the return values | 510 | h = 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 |
| 512 | SLEEP(0.5) | 512 | SLEEP(0.5) |
| 513 | print("joining with '" .. h:get_threadname() .. "'") | 513 | print("joining with '" .. h:get_threadname() .. "'") |
| 514 | local a,b,c,d= h:join() | 514 | local r,a,b,c,d= h:join() |
| 515 | if h.status == "error" then | 515 | if 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) |
| 517 | else | 517 | else |
| 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) | ||
| 523 | end | 524 | end |
| 524 | 525 | ||
| 525 | local nameof_type, nameof_name = lanes.nameof(print) | 526 | local nameof_type, nameof_name = lanes.nameof(print) |
