lua: unary-minus/^ precedence (^ binds tighter); parse-pow-chain helper +3 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:
@@ -928,6 +928,14 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 1831)
|
||||
(eval "(lua-eval-ast \"if \\\"\\\\09912\\\" == \\\"c12\\\" then return 1 else return 0 end\")")
|
||||
|
||||
;; ── Unary-minus / ^ precedence (Lua spec: ^ tighter than -) ──
|
||||
(epoch 1840)
|
||||
(eval "(lua-eval-ast \"return -2^2\")")
|
||||
(epoch 1841)
|
||||
(eval "(lua-eval-ast \"return 2^3^2\")")
|
||||
(epoch 1842)
|
||||
(eval "(lua-eval-ast \"if -2^2 == -4 then return 1 else return 0 end\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1401,6 +1409,11 @@ check 1821 "arg[i] access" '60'
|
||||
check 1830 "\\65 → A" '"A"'
|
||||
check 1831 "\\099 + 12 → c12" '1'
|
||||
|
||||
# ── Unary-minus / ^ precedence (Lua: ^ tighter than unary -) ──
|
||||
check 1840 "-2^2 = -4" '-4'
|
||||
check 1841 "2^3^2 = 512 (right-assoc)" '512'
|
||||
check 1842 "-2^2 == -4 true" '1'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user