Skip to content

Commit

Permalink
Fix compatibility with Lua 5.4.4+
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
Flamefire committed Jan 5, 2025
1 parent 4e75497 commit a808e47
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/test_06_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ KAGUYA_TEST_FUNCTION_DEF(allocation_error_test)(kaguya::State &) {
} catch (const kaguya::LuaMemoryError &) {
continue;
}
#if LUA_VERSION_RELEASE_NUM >= 50404
// In Lua 5.4.4+ we don't get a specific error status for Lua panics
catch (const kaguya::LuaUnknownError & e) {
if (std::string(e.what()).find("memory") != std::string::npos)
continue;
}
#endif
TEST_CHECK(false);
}
}
Expand Down

0 comments on commit a808e47

Please sign in to comment.