ocaml: phase 6 Filename module + Char.compare/equal/escaped (+7 tests, 569 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
Filename module (forward-slash only, no Windows-separator detection): basename '/foo/bar/baz.ml' = 'baz.ml' dirname '/foo/bar/baz.ml' = '/foo/bar' extension 'baz.tar.gz' = '.gz' chop_extension 'hello.ml' = 'hello' concat 'a' 'b' = 'a/b' is_relative 'a/b' = true current_dir_name = '.', parent_dir_name = '..', dir_sep = '/' Char additions: equal a b = (a = b) compare a b = code(a) - code(b) escaped '\n' = '\\n' (likewise t, r, \\, ")
This commit is contained in:
@@ -1404,6 +1404,24 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 5152)
|
||||
(eval "(ocaml-run \"let f ?x ~y = x + y in f ?x:1 ~y:2\")")
|
||||
|
||||
;; ── Filename module ──────────────────────────────────────────
|
||||
(epoch 5160)
|
||||
(eval "(ocaml-run \"Filename.basename \\\"/foo/bar/baz.ml\\\"\")")
|
||||
(epoch 5161)
|
||||
(eval "(ocaml-run \"Filename.dirname \\\"/foo/bar/baz.ml\\\"\")")
|
||||
(epoch 5162)
|
||||
(eval "(ocaml-run \"Filename.extension \\\"baz.tar.gz\\\"\")")
|
||||
(epoch 5163)
|
||||
(eval "(ocaml-run \"Filename.concat \\\"a\\\" \\\"b\\\"\")")
|
||||
(epoch 5164)
|
||||
(eval "(ocaml-run \"Filename.chop_extension \\\"hello.ml\\\"\")")
|
||||
|
||||
;; ── Char.compare / equal / escaped ─────────────────────────
|
||||
(epoch 5170)
|
||||
(eval "(ocaml-run \"Char.compare \\\"b\\\" \\\"a\\\"\")")
|
||||
(epoch 5171)
|
||||
(eval "(ocaml-run \"Char.equal \\\"a\\\" \\\"a\\\"\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 360 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -2232,6 +2250,17 @@ check 5150 "f ~x:3 ~y:7 sum" '10'
|
||||
check 5151 "f ~x ~y punning" '20'
|
||||
check 5152 "f ?x:1 ~y:2 (no Some wrap)" '3'
|
||||
|
||||
# ── Filename module ─────────────────────────────────────────────
|
||||
check 5160 "basename /foo/bar/baz.ml" '"baz.ml"'
|
||||
check 5161 "dirname /foo/bar/baz.ml" '"/foo/bar"'
|
||||
check 5162 "extension baz.tar.gz" '".gz"'
|
||||
check 5163 "concat a b" '"a/b"'
|
||||
check 5164 "chop_extension hello.ml" '"hello"'
|
||||
|
||||
# ── Char.compare / equal ────────────────────────────────────────
|
||||
check 5170 "Char.compare b a" '1'
|
||||
check 5171 "Char.equal a a" 'true'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user