diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-06-26 09:18:54 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-06-26 09:18:54 +0200 |
| commit | d7d756e30680bcff036118b47ac45b740e020ea2 (patch) | |
| tree | 3e2a26409154760d66092e6e04a9fcb4ad4ed02a /unit_tests/lane_tests.cpp | |
| parent | 4f5fa626c0279f5aefac477a29702c43a6754c5a (diff) | |
| download | lanes-d7d756e30680bcff036118b47ac45b740e020ea2.tar.gz lanes-d7d756e30680bcff036118b47ac45b740e020ea2.tar.bz2 lanes-d7d756e30680bcff036118b47ac45b740e020ea2.zip | |
Preparation for lane:close() and correct to-be-closed variables
* lane:join() can no longer be used to read yielded values
* same with lane indexing
* stub for lane:close(), similar to coroutine.close() (not implemented yet)
* preparing tests for to-be-closed variables in yielded coroutine lanes
* yielded lanes unlock and terminate properly at Lanes shutdown
Diffstat (limited to 'unit_tests/lane_tests.cpp')
| -rw-r--r-- | unit_tests/lane_tests.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/unit_tests/lane_tests.cpp b/unit_tests/lane_tests.cpp index 82ca1ad..c4d3c95 100644 --- a/unit_tests/lane_tests.cpp +++ b/unit_tests/lane_tests.cpp | |||
| @@ -421,7 +421,7 @@ TEST_CASE("scripted_tests." #DIR "." #FILE) \ | |||
| 421 | 421 | ||
| 422 | MAKE_TEST_CASE(lane, body_is_a_c_function, AssertNoLuaError) | 422 | MAKE_TEST_CASE(lane, body_is_a_c_function, AssertNoLuaError) |
| 423 | MAKE_TEST_CASE(lane, cooperative_shutdown, AssertNoLuaError) | 423 | MAKE_TEST_CASE(lane, cooperative_shutdown, AssertNoLuaError) |
| 424 | #if LUA_VERSION_NUM >= 504 // // warnings are a Lua 5.4 feature | 424 | #if LUA_VERSION_NUM >= 504 // warnings are a Lua 5.4 feature |
| 425 | // NOTE: when this test ends, there are resource leaks and a dangling thread | 425 | // NOTE: when this test ends, there are resource leaks and a dangling thread |
| 426 | MAKE_TEST_CASE(lane, uncooperative_shutdown, AssertWarns) | 426 | MAKE_TEST_CASE(lane, uncooperative_shutdown, AssertWarns) |
| 427 | #endif // LUA_VERSION_NUM | 427 | #endif // LUA_VERSION_NUM |
| @@ -434,11 +434,16 @@ MAKE_TEST_CASE(lane, tasking_error, AssertNoLuaError) | |||
| 434 | MAKE_TEST_CASE(lane, tasking_join_test, AssertNoLuaError) | 434 | MAKE_TEST_CASE(lane, tasking_join_test, AssertNoLuaError) |
| 435 | MAKE_TEST_CASE(lane, tasking_send_receive_code, AssertNoLuaError) | 435 | MAKE_TEST_CASE(lane, tasking_send_receive_code, AssertNoLuaError) |
| 436 | MAKE_TEST_CASE(lane, stdlib_naming, AssertNoLuaError) | 436 | MAKE_TEST_CASE(lane, stdlib_naming, AssertNoLuaError) |
| 437 | MAKE_TEST_CASE(coro, basics, AssertNoLuaError) | 437 | |
| 438 | #if LUA_VERSION_NUM >= 504 // this makes use of to-be-closed variables, a Lua 5.4 feature | ||
| 439 | MAKE_TEST_CASE(coro, collect_yielded_lane, AssertNoLuaError) | ||
| 440 | #endif // LUA_VERSION_NUM | ||
| 438 | #if LUAJIT_FLAVOR() == 0 | 441 | #if LUAJIT_FLAVOR() == 0 |
| 439 | // TODO: for some reason, the test fails with LuaJIT. To be investigated | 442 | // TODO: for some reason, the test fails with LuaJIT. To be investigated |
| 440 | MAKE_TEST_CASE(coro, error_handling, AssertNoLuaError) | 443 | MAKE_TEST_CASE(coro, error_handling, AssertNoLuaError) |
| 441 | #endif // LUAJIT_FLAVOR() | 444 | #endif // LUAJIT_FLAVOR() |
| 445 | MAKE_TEST_CASE(coro, regular_function, AssertNoLuaError) | ||
| 446 | MAKE_TEST_CASE(coro, yielding_function, AssertNoLuaError) | ||
| 442 | 447 | ||
| 443 | /* | 448 | /* |
| 444 | TEST_CASE("lanes.scripted_tests") | 449 | TEST_CASE("lanes.scripted_tests") |
