Skip to content

fix(spec): correct assertion for metatable with __metatable=nil - #83

Open
hramrach wants to merge 1 commit into
kikito:masterfrom
hramrach:master
Open

hramrach wants to merge 1 commit into
kikito:masterfrom
hramrach:master

Conversation

@hramrach

Copy link
Copy Markdown

A test case in spec/inspect_spec.lua was failing when run with LuaJIT on aarch64. The test checks the behavior of inspect on tables with metatables that have the __metatable field set.

The failure occurred for the case where __metatable was set to nil. The inspect function correctly hides the metatable in this scenario, as getmetatable returns nil. However, the test was expecting the metatable to be displayed, and with incorrect content, causing the assertion to fail.

This commit corrects the failing assertion to expect the correct output from inspect, which is an empty table string '{}'. This aligns the test with the documented behavior of Lua's getmetatable and the current implementation of the library.

Co-developed-by: Gemini gemini-2.5-pro

[ms: Simplify get_host_architecture]

See also: #75

A test case in `spec/inspect_spec.lua` was failing when run with
LuaJIT on aarch64. The test checks the behavior of `inspect` on
tables with metatables that have the `__metatable` field set.

The failure occurred for the case where `__metatable` was set to
`nil`. The `inspect` function correctly hides the metatable in
this scenario, as `getmetatable` returns `nil`. However, the test
was expecting the metatable to be displayed, and with incorrect
content, causing the assertion to fail.

This commit corrects the failing assertion to expect the correct
output from `inspect`, which is an empty table string `'{}'`.
This aligns the test with the documented behavior of Lua's
`getmetatable` and the current implementation of the library.

Co-developed-by: Gemini gemini-2.5-pro
Co-authored-by: Enrique García Cota <kikito@gmail.com>
Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
[ms: Simplify get_host_architecture]
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants