lua: do-block proper lexical scoping (wrap in (let () …)) +2 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:
@@ -902,6 +902,12 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 1705)
|
||||
(eval "(lua-eval-ast \"local function f(a, b, ...) return a * 100 + b * 10 + select(\\\"#\\\", ...) end return f(7, 8, 1, 2, 3)\")")
|
||||
|
||||
;; ── Phase 7: do-block proper scoping ──────────────────────────
|
||||
(epoch 1800)
|
||||
(eval "(lua-eval-ast \"local i = 10 do local i = 100 end return i\")")
|
||||
(epoch 1801)
|
||||
(eval "(lua-eval-ast \"do local i = 10 do local i = 100 assert(i == 100) end assert(i == 10) end return \\\"ok\\\"\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1358,6 +1364,10 @@ check 1703 "select(2, ...) unpack" '50'
|
||||
check 1704 "sum via ipairs({...})" '15'
|
||||
check 1705 "f(a, b, ...) mixed" '783'
|
||||
|
||||
# ── Phase 7: do-block proper scoping ──────────────────────────
|
||||
check 1800 "inner do local shadows" '10'
|
||||
check 1801 "nested do scopes" '"ok"'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user