From 268b58964c3bc1d6e6ee35b236d9af49896098de Mon Sep 17 00:00:00 2001 From: Shepherd Date: Wed, 22 Jun 2022 22:38:14 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Avoid=20shadowing=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/source/1315 - keep-alive memory.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/regression_tests/simple/source/1315 - keep-alive memory.cpp b/tests/regression_tests/simple/source/1315 - keep-alive memory.cpp index 24240e16..37562860 100644 --- a/tests/regression_tests/simple/source/1315 - keep-alive memory.cpp +++ b/tests/regression_tests/simple/source/1315 - keep-alive memory.cpp @@ -46,7 +46,14 @@ inline namespace sol2_regression_test_1315 { return a.children; } - constexpr const auto& code = R"( +} // namespace sol2_regression_test_1315 + + +TEST_CASE("Test for Issue #1315 - memory keep-alive with iteration functions, using a pointer", "[sol2][regression][Issue-1315][pointer]") { + sol::state lua; + lua.open_libraries(sol::lib::base, sol::lib::coroutine); + + constexpr const auto& coroutine_iteration_code = R"( for i=1, 100 do co = coroutine.create( function() for child_index, child in ipairs(A.children) do @@ -58,13 +65,6 @@ end) coroutine.resume(co) end)"; -} // namespace sol2_regression_test_1315 - - -TEST_CASE("Test for Issue #1315 - memory keep-alive with iteration functions, using a pointer", "[sol2][regression][Issue-1315][pointer]") { - sol::state lua; - lua.open_libraries(sol::lib::base, sol::lib::coroutine); - A a {}; for (int i = 0; i < 100; i++) { a.children.push_back(i); @@ -72,7 +72,7 @@ TEST_CASE("Test for Issue #1315 - memory keep-alive with iteration functions, us auto perform_action = [&lua]() { // call lua code directly - auto result = lua.safe_script(code, sol::script_pass_on_error); + auto result = lua.safe_script(coroutine_iteration_code, sol::script_pass_on_error); sol::optional maybe_err = result.get>(); REQUIRE(result.status() == sol::call_status::ok); REQUIRE_FALSE(maybe_err.has_value());