lua: pattern character sets [...] and [^...] +3 tests; tests reach deeper code
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-24 23:52:39 +00:00
parent 0491f061c4
commit 77f20b713d
5 changed files with 119 additions and 47 deletions

View File

@@ -986,6 +986,14 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 1902)
(eval "(lua-eval-ast \"if tonumber('99', 8) == nil then return 1 else return 0 end\")")
;; ── Pattern character sets [...] ──────────────────────────────
(epoch 1910)
(eval "(lua-eval-ast \"return string.match(\\\"hello123\\\", \\\"[a-z]+\\\")\")")
(epoch 1911)
(eval "(lua-eval-ast \"return string.match(\\\"hello123\\\", \\\"[0-9]+\\\")\")")
(epoch 1912)
(eval "(lua-eval-ast \"return string.match(\\\"abc\\\", \\\"[^a]+\\\")\")")
EPOCHS
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1495,6 +1503,11 @@ check 1900 "tonumber('1010', 2)" '10'
check 1901 "tonumber('FF', 16)" '255'
check 1902 "tonumber('99', 8) → nil" '1'
# ── Pattern character sets [...] ─────────────────────────────
check 1910 "[a-z]+ on hello123" '"hello"'
check 1911 "[0-9]+ on hello123" '"123"'
check 1912 "[^a]+ on abc" '"bc"'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"