aboutsummaryrefslogtreecommitdiff
path: root/unit_tests/lane_tests.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-06-26 09:18:54 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2025-06-26 09:18:54 +0200
commitd7d756e30680bcff036118b47ac45b740e020ea2 (patch)
tree3e2a26409154760d66092e6e04a9fcb4ad4ed02a /unit_tests/lane_tests.cpp
parent4f5fa626c0279f5aefac477a29702c43a6754c5a (diff)
downloadlanes-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.cpp9
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
422MAKE_TEST_CASE(lane, body_is_a_c_function, AssertNoLuaError) 422MAKE_TEST_CASE(lane, body_is_a_c_function, AssertNoLuaError)
423MAKE_TEST_CASE(lane, cooperative_shutdown, AssertNoLuaError) 423MAKE_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
426MAKE_TEST_CASE(lane, uncooperative_shutdown, AssertWarns) 426MAKE_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)
434MAKE_TEST_CASE(lane, tasking_join_test, AssertNoLuaError) 434MAKE_TEST_CASE(lane, tasking_join_test, AssertNoLuaError)
435MAKE_TEST_CASE(lane, tasking_send_receive_code, AssertNoLuaError) 435MAKE_TEST_CASE(lane, tasking_send_receive_code, AssertNoLuaError)
436MAKE_TEST_CASE(lane, stdlib_naming, AssertNoLuaError) 436MAKE_TEST_CASE(lane, stdlib_naming, AssertNoLuaError)
437MAKE_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
439MAKE_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
440MAKE_TEST_CASE(coro, error_handling, AssertNoLuaError) 443MAKE_TEST_CASE(coro, error_handling, AssertNoLuaError)
441#endif // LUAJIT_FLAVOR() 444#endif // LUAJIT_FLAVOR()
445MAKE_TEST_CASE(coro, regular_function, AssertNoLuaError)
446MAKE_TEST_CASE(coro, yielding_function, AssertNoLuaError)
442 447
443/* 448/*
444TEST_CASE("lanes.scripted_tests") 449TEST_CASE("lanes.scripted_tests")