ocaml: phase 3 exception declarations (+4 tests, 304 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
exception NAME [of TYPE] parses to (:exception-def NAME [ARG-SRC]). Runtime is a no-op: raise/match already work on tagged ctor values, so 'exception E of int;; try raise (E 5) with | E n -> n' end-to-end with zero new eval logic.
This commit is contained in:
@@ -754,6 +754,16 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 1304)
|
||||
(eval "(ocaml-run-program \"type shape = Circle of int | Square of int ;; match Circle 5 with | Circle r -> r | Square s -> s\")")
|
||||
|
||||
;; ── exception declarations ────────────────────────────────────
|
||||
(epoch 1320)
|
||||
(eval "(ocaml-parse-program \"exception MyExn\")")
|
||||
(epoch 1321)
|
||||
(eval "(ocaml-parse-program \"exception MyExn of int\")")
|
||||
(epoch 1322)
|
||||
(eval "(ocaml-run-program \"exception E of int ;; try raise (E 5) with | E n -> n\")")
|
||||
(epoch 1323)
|
||||
(eval "(ocaml-run-program \"exception E of string ;; try raise (E \\\"oops\\\") with | E s -> s\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1194,6 +1204,12 @@ check 1302 "type-decl + match Red" '1'
|
||||
check 1303 "type-decl + match Blue" '3'
|
||||
check 1304 "type-decl + Circle r" '5'
|
||||
|
||||
# ── exception declarations ─────────────────────────────────────
|
||||
check 1320 "exception nullary" '("exception-def" "MyExn")'
|
||||
check 1321 "exception arg" '("exception-def" "MyExn"'
|
||||
check 1322 "raise+catch with arg" '5'
|
||||
check 1323 "raise+catch string arg" '"oops"'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user