js-on-sx: String.fromCharCode + parseInt + parseFloat

String global with fromCharCode (variadic). parseInt truncates via
js-math-trunc; parseFloat delegates to js-to-number. Wired into
js-global.

381/383 unit (+5), 148/148 slice unchanged.
This commit is contained in:
2026-04-23 21:16:41 +00:00
parent 449b77cbb0
commit 6f0b4fb476
3 changed files with 51 additions and 1 deletions

View File

@@ -981,8 +981,21 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 1803)
(eval "(js-eval \"({x:1}).valueOf().x\")")
;; ── Phase 11.fromCharCode: String/parseInt/parseFloat ──────────
(epoch 1900)
(eval "(js-eval \"String.fromCharCode(65)\")")
(epoch 1901)
(eval "(js-eval \"String.fromCharCode(72, 105)\")")
(epoch 1902)
(eval "(js-eval \"parseInt('42')\")")
(epoch 1903)
(eval "(js-eval \"parseInt(3.7)\")")
(epoch 1904)
(eval "(js-eval \"parseFloat('3.14')\")")
EPOCHS
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
check() {
@@ -1505,6 +1518,13 @@ check 1801 "hasOwnProperty no" 'false'
check 1802 "({}).toString()" '"[object Object]"'
check 1803 "obj.valueOf().x" '1'
# ── Phase 11.fromCharCode / parseInt / parseFloat ──────────────
check 1900 "String.fromCharCode(65)" '"A"'
check 1901 "String.fromCharCode(72,105)" '"Hi"'
check 1902 "parseInt('42')" '42'
check 1903 "parseInt(3.7)" '3'
check 1904 "parseFloat('3.14')" '3.14'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "$PASS/$TOTAL JS-on-SX tests passed"