Repository navigation
Closed
Labels
direction:ADirection A: suite triage to 0.5.0Direction A: suite triage to 0.5.0kind:suiteLua 5.3 official test suite workLua 5.3 official test suite work
Milestone
Description
Problem
Several Lua 5.3 suite files (math.lua, sort.lua, errors.lua, strings.lua, goto.lua) use a checkerror(msg, f, ...) helper that calls pcall(f, ...) and asserts string.find(err, msg) matches a specific substring. We produce the right error category but the wrong phrasing, so dozens of assertions fail.
Concrete templates to match
"wrong number of arguments to 'X'"— when too few/many args (e.g.table.insert({}, 2, 3, 4)). One case already fixed in suite: triage and promote literals/goto/events/nextvar files #251."bad argument #N to 'X' (T expected, got T)"— verify the exact wording across all stdlib argument-error sites."attempt to perform 'n//0'"— integer divide-by-zero (op token included)."... has no integer representation"— float-to-int conversions (f | 1,f >> 0, bitwise on non-representable floats)."field 'X'"prefix when arithmetic/indexing fails on a global access (e.g.math.huge << 1→"field 'huge'").
Why it matters
This is the biggest single lever for suite progress. Likely unlocks 60–150 individual asserts across at least 4 suite files. The work is mechanical: identify each raise site in lib/lua/vm/stdlib* and lib/lua/vm/executor.ex, compare wording to PUC-Lua's luaL_error/luaL_argerror output, adjust.
Suggested approach
- Audit the existing
Lua.VM.ArgumentErrortemplate inlib/lua/vm/argument_error.exagainst PUC-Lua'sluaL_argerrorformat. - Add a single helper for "wrong number of arguments to 'X'" and route variadic stdlib functions through it.
- For arithmetic-on-globals errors, attach the field hint that
:get_field/:get_globalalready tracks. - Pin each template with a unit test under
test/lua/vm/so the wording is enforced.
Acceptance
- New unit tests pinning each error template.
- Re-running the suite shows progress in
math.lua,sort.lua,errors.lua,strings.lua(some still deferred for other reasons, but theircheckerrorranges should shrink or pass).
Metadata
Metadata
Assignees
Labels
direction:ADirection A: suite triage to 0.5.0Direction A: suite triage to 0.5.0kind:suiteLua 5.3 official test suite workLua 5.3 official test suite work
Activity