ocaml: phase 6 String extensions (+6 tests, 406 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s

ends_with, contains, trim, split_on_char, replace_all, index_of —
wrap host SX primitives via new _string_* builtins. String module
now substantively covers OCaml's Stdlib.String.
This commit is contained in:
2026-05-08 15:34:18 +00:00
parent 9f05e24c52
commit f40dfbbeb5
4 changed files with 43 additions and 3 deletions

View File

@@ -990,6 +990,20 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 2905)
(eval "(ocaml-run \"List.take 100 [1;2;3]\")")
;; ── String extensions ──────────────────────────────────────────
(epoch 3000)
(eval "(ocaml-run \"String.ends_with \\\"lo\\\" \\\"hello\\\"\")")
(epoch 3001)
(eval "(ocaml-run \"String.contains \\\"hello\\\" \\\"ell\\\"\")")
(epoch 3002)
(eval "(ocaml-run \"String.trim \\\" hi \\\"\")")
(epoch 3003)
(eval "(ocaml-run \"String.split_on_char \\\" \\\" \\\"a b c\\\"\")")
(epoch 3004)
(eval "(ocaml-run \"String.replace_all \\\"hello\\\" \\\"l\\\" \\\"r\\\"\")")
(epoch 3005)
(eval "(ocaml-run \"String.index_of \\\"hello\\\" \\\"ll\\\"\")")
EPOCHS
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1566,6 +1580,14 @@ check 2903 "List.flat_map double" '(1 1 2 2 3 3)'
check 2904 "List.take 0" '()'
check 2905 "List.take overflow" '(1 2 3)'
# ── String extensions ──────────────────────────────────────────
check 3000 "String.ends_with" 'true'
check 3001 "String.contains" 'true'
check 3002 "String.trim" '"hi"'
check 3003 "String.split_on_char" '("a" "b" "c")'
check 3004 "String.replace_all" '"herro"'
check 3005 "String.index_of" '2'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"