Skip to content

Commit a808e47

Browse files
committed
Fix compatibility with Lua 5.4.4+
A change in Lua 5.4.4 resets the Lua status to OK before calling the panic handler. This affects a test checking for an out-of-memory exception. Check the message string instead for something memory related which is "good enough".
1 parent 4e75497 commit a808e47

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/test_06_state.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ KAGUYA_TEST_FUNCTION_DEF(allocation_error_test)(kaguya::State &) {
366366
} catch (const kaguya::LuaMemoryError &) {
367367
continue;
368368
}
369+
#if LUA_VERSION_RELEASE_NUM >= 50404
370+
// In Lua 5.4.4+ we don't get a specific error status for Lua panics
371+
catch (const kaguya::LuaUnknownError & e) {
372+
if (std::string(e.what()).find("memory") != std::string::npos)
373+
continue;
374+
}
375+
#endif
369376
TEST_CHECK(false);
370377
}
371378
}

0 commit comments

Comments
 (0)