Space Lua: Align arithmetical error messages with Lua 5.4 (#1793)
* Space Lua: `<close>` attribute, `__close` metamethod and extensive tests Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz> * Space Lua: Align arithmetical error messages with Lua 5.4 **Fixes:** - Tighten `tonumber` semantics to accept hex floats like `0x1.2` while keeping plain hex as integers. - Improve Lua compatibility by fixing relational `>`/`>=` operand ordering to preserve correct error type direction. **Changes:** - Update concatenation errors to include the operand type. - Add `LuaStringCoercionError` from numeric coercion and handle it in `luaOp()` to emit correct messages (or fallback). - Raise > `bad argument #2 to 'tonumber' (base out of range)` for invalid bases. - Update test suite **Notes:** - The `arithmetic_test.lua` test suite now passes if run with Lua 5.4. Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz> * Run `make fmt` Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz> * Rename `assert_throws` to `assertThrows` in Lua test suite Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz> * Replace `LuaStringCoercionError` class with sentinel constant Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz> --------- Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
This commit is contained in:
@@ -77,7 +77,7 @@ Deno.test("Context error: modulo by zero includes message and ref", async () =>
|
||||
`,
|
||||
"mod_zero.lua",
|
||||
);
|
||||
assertCtxErrorContains(e, code, ref, "attempt to perform modulo by zero");
|
||||
assertCtxErrorContains(e, code, ref, "attempt to perform 'n%0'");
|
||||
});
|
||||
|
||||
Deno.test("Context error: type mismatch in comparison includes message and ref", async () => {
|
||||
|
||||
Reference in New Issue
Block a user