lua: method-call binds obj to temp (no more double-eval); chaining works +1 test
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:
@@ -954,6 +954,10 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 1863)
|
||||
(eval "(lua-eval-ast \"local i = 0 repeat i = i + 1 if i >= 3 then break end until false return i\")")
|
||||
|
||||
;; ── Method-call chaining (obj evaluated once) ────────────────
|
||||
(epoch 1870)
|
||||
(eval "(lua-eval-ast \"local a = {x=0} function a:add(x) self.x = self.x+x return self end return a:add(10):add(20):add(30).x\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1443,6 +1447,9 @@ check 1861 "break in for-num" '55'
|
||||
check 1862 "break in for-in" '30'
|
||||
check 1863 "break in repeat" '3'
|
||||
|
||||
# ── Method-call chaining ─────────────────────────────────────
|
||||
check 1870 "a:add():add():add().x chain" '60'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user