From d361d83402a3b1c06759a6bb86a88777c06b0d24 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 24 Apr 2026 20:11:31 +0000 Subject: [PATCH] =?UTF-8?q?lua:=20scoreboard=20iter=20=E2=80=94=20trim=20w?= =?UTF-8?q?hitespace=20in=20lua-to-number=20(math.lua=20past=20arith-type)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/lua/runtime.sx | 2 +- lib/lua/scoreboard.json | 38 +++++++++++++++++--------------------- lib/lua/scoreboard.md | 33 ++++++++++++++++----------------- plans/lua-on-sx.md | 1 + 4 files changed, 35 insertions(+), 39 deletions(-) diff --git a/lib/lua/runtime.sx b/lib/lua/runtime.sx index da641675..92dac8e9 100644 --- a/lib/lua/runtime.sx +++ b/lib/lua/runtime.sx @@ -7,7 +7,7 @@ (cond ((= (type-of v) "number") v) ((= (type-of v) "string") - (let ((n (parse-number v))) (if (= n nil) nil n))) + (let ((n (parse-number (trim v)))) (if (= n nil) nil n))) (else nil)))) (define diff --git a/lib/lua/scoreboard.json b/lib/lua/scoreboard.json index 84736706..950e55f6 100644 --- a/lib/lua/scoreboard.json +++ b/lib/lua/scoreboard.json @@ -11,16 +11,12 @@ "top_failure_modes": [ [ "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - 11 + 12 ], [ "timeout", 3 ], - [ - "arith type error", - 1 - ], [ "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio", 1 @@ -43,7 +39,7 @@ "name": "attrib.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 5703 + "ms": 5513 }, { "name": "big.lua", @@ -55,7 +51,7 @@ "name": "calls.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 4488 + "ms": 4561 }, { "name": "checktable.lua", @@ -67,7 +63,7 @@ "name": "closure.lua", "status": "timeout", "reason": "per-test timeout", - "ms": 8007 + "ms": 8003 }, { "name": "code.lua", @@ -79,7 +75,7 @@ "name": "constructs.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 4285 + "ms": 4113 }, { "name": "db.lua", @@ -91,13 +87,13 @@ "name": "errors.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 3049 + "ms": 2947 }, { "name": "events.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 6639 + "ms": 6820 }, { "name": "files.lua", @@ -115,13 +111,13 @@ "name": "literals.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 1774 + "ms": 1783 }, { "name": "locals.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 1552 + "ms": 1529 }, { "name": "main.lua", @@ -132,44 +128,44 @@ { "name": "math.lua", "status": "fail", - "reason": "arith type error", - "ms": 3789 + "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", + "ms": 3855 }, { "name": "nextvar.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 6939 + "ms": 6738 }, { "name": "pm.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 5707 + "ms": 5693 }, { "name": "sort.lua", "status": "timeout", "reason": "per-test timeout", - "ms": 8007 + "ms": 8005 }, { "name": "strings.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 3846 + "ms": 3837 }, { "name": "vararg.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 2116 + "ms": 2105 }, { "name": "verybig.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio", - "ms": 534 + "ms": 547 } ] } \ No newline at end of file diff --git a/lib/lua/scoreboard.md b/lib/lua/scoreboard.md index 979828a6..ffe09674 100644 --- a/lib/lua/scoreboard.md +++ b/lib/lua/scoreboard.md @@ -5,9 +5,8 @@ fail=13 timeout=3 skip=8 total=24 ## Top failure modes -- **11x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ +- **12x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ - **3x** timeout -- **1x** arith type error - **1x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio ## Per-test results @@ -16,25 +15,25 @@ fail=13 timeout=3 skip=8 total=24 |---|---|---|---:| | all.lua | skip | driver uses dofile to chain other tests | 0 | | api.lua | skip | requires testC (C debug library) | 0 | -| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5703 | +| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5513 | | big.lua | timeout | per-test timeout | 8008 | -| calls.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4488 | +| calls.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4561 | | checktable.lua | skip | internal debug helpers | 0 | -| closure.lua | timeout | per-test timeout | 8007 | +| closure.lua | timeout | per-test timeout | 8003 | | code.lua | skip | bytecode inspection via debug library | 0 | -| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4285 | +| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4113 | | db.lua | skip | debug library | 0 | -| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3049 | -| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6639 | +| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2947 | +| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6820 | | files.lua | skip | io library | 0 | | gc.lua | skip | collectgarbage / finalisers | 0 | -| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1774 | -| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1552 | +| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1783 | +| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1529 | | main.lua | skip | standalone interpreter driver | 0 | -| math.lua | fail | arith type error | 3789 | -| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6939 | -| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5707 | -| sort.lua | timeout | per-test timeout | 8007 | -| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3846 | -| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2116 | -| verybig.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 534 | +| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3855 | +| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6738 | +| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5693 | +| sort.lua | timeout | per-test timeout | 8005 | +| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3837 | +| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2105 | +| verybig.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 547 | diff --git a/plans/lua-on-sx.md b/plans/lua-on-sx.md index f6e15a27..807a1757 100644 --- a/plans/lua-on-sx.md +++ b/plans/lua-on-sx.md @@ -82,6 +82,7 @@ Each item: implement → tests → tick box → update progress log. _Newest first. Agent appends on every commit._ +- 2026-04-24: lua: scoreboard iteration — `lua-to-number` trims whitespace before `parse-number` (Lua coerces `" 3e0 "` in arithmetic). math.lua moved past the arith-type error to deeper assertion-land. 12× asserts / 3× timeouts / 1× call-non-fn. - 2026-04-24: lua: scoreboard iteration — `table.getn`/`setn`/`foreach`/`foreachi` (Lua 5.0-era), `string.reverse`. `sort.lua` unblocked past `getn`-undef; now times out on the 30k-element sort body (insertion sort too slow). 13 fail / 3 timeout / 0 pass. - 2026-04-24: lua: scoreboard iteration — parser consumes trailing `;` after `return`; added `collectgarbage`/`setfenv`/`getfenv`/`T` stubs. All parse errors and undefined-symbol failures eliminated — every runnable test now executes deep into the script. Failure mix: **11× assertion failed**, 2× timeout, 2× call-non-fn, 1× arith. Still 0/16 pass but the remaining work is substantive (stdlib fidelity vs the exact PUC-Rio assertions). - 2026-04-24: lua: scoreboard iteration — trailing-dot number literals (`5.`), preload stdlibs in `package.loaded` (`string`/`math`/`table`/`io`/`os`/`coroutine`/`package`/`_G`), `arg` stub, `debug` module stub. Assertion-failure count 4→**8**, parse errors 3→**1**, call-non-fn stable, module-not-found gone.