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 /unit_tests/scripts/coro/basics.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 'unit_tests/scripts/coro/basics.lua')
| -rw-r--r-- | unit_tests/scripts/coro/basics.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/unit_tests/scripts/coro/basics.lua b/unit_tests/scripts/coro/basics.lua index cd2f410..c0b7a36 100644 --- a/unit_tests/scripts/coro/basics.lua +++ b/unit_tests/scripts/coro/basics.lua | |||
| @@ -85,7 +85,8 @@ if true then | |||
| 85 | assert(h3:resume(1) == nil) | 85 | assert(h3:resume(1) == nil) |
| 86 | 86 | ||
| 87 | -- similarly, we can get them with join() | 87 | -- similarly, we can get them with join() |
| 88 | assert(h3:join() == "world" and h3.status == "suspended") | 88 | local r3, ret3 = h3:join() |
| 89 | assert(r3 == true and ret3 == "world" and h3.status == "suspended") | ||
| 89 | -- since we consumed the returned values, they should not be here when we resume | 90 | -- since we consumed the returned values, they should not be here when we resume |
| 90 | assert(h3:resume(2) == nil) | 91 | assert(h3:resume(2) == nil) |
| 91 | 92 | ||
| @@ -93,5 +94,6 @@ if true then | |||
| 93 | assert(h3:resume(3) == "!") | 94 | assert(h3:resume(3) == "!") |
| 94 | 95 | ||
| 95 | -- the final return value of the lane body remains to be read | 96 | -- the final return value of the lane body remains to be read |
| 96 | assert(h3:join() == "done!" and h3.status == "done") | 97 | local r3, ret3 = h3:join() |
| 98 | assert(r3 == true and ret3 == "done!" and h3.status == "done") | ||
| 97 | end | 99 | end |
