lua: break via guard+raise sentinel; auto-first multi in arith/concat +4 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -944,6 +944,16 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 1852)
|
||||
(eval "(lua-eval-ast \"function f(i) if type(i) ~= \\\"number\\\" then return i, \\\"jojo\\\" end if i > 0 then return i, f(i-1) end end local a, b = f(3) return a\")")
|
||||
|
||||
;; ── break via sentinel (escapes while/for-num/for-in/repeat) ──
|
||||
(epoch 1860)
|
||||
(eval "(lua-eval-ast \"local i = 0 while true do i = i + 1 if i >= 5 then break end end return i\")")
|
||||
(epoch 1861)
|
||||
(eval "(lua-eval-ast \"local s = 0 for i = 1, 100 do if i > 10 then break end s = s + i end return s\")")
|
||||
(epoch 1862)
|
||||
(eval "(lua-eval-ast \"local t = {10, 20, 99, 40} local s = 0 for i, v in ipairs(t) do if v == 99 then break end s = s + v end return s\")")
|
||||
(epoch 1863)
|
||||
(eval "(lua-eval-ast \"local i = 0 repeat i = i + 1 if i >= 3 then break end until false return i\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1427,6 +1437,12 @@ check 1850 "early return negative path" '-1'
|
||||
check 1851 "non-early return path" '14'
|
||||
check 1852 "nested early-return recursion" '3'
|
||||
|
||||
# ── break via sentinel ───────────────────────────────────────
|
||||
check 1860 "break in while" '5'
|
||||
check 1861 "break in for-num" '55'
|
||||
check 1862 "break in for-in" '30'
|
||||
check 1863 "break in repeat" '3'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user