mte/unikernel/duniverse/ocaml-re/lib_test/expect/test_validation.ml
2025-11-11 02:07:51 +01:00

12 lines
344 B
OCaml

open Import
let () = Printexc.record_backtrace false
let any = Re.(compile (rep any))
let%expect_test "bound errors" =
let (_ : bool) = Re.execp any ~pos:4 "foo" in
[%expect {| |}];
let (_ : bool) = Re.execp any ~pos:1 ~len:3 "foo" in
[%expect.unreachable]
[@@expect.uncaught_exn {| (Invalid_argument "Re.exec: out of bounds") |}]
;;