File: test_validation.ml

package info (click to toggle)
ocaml-re 1.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 848 kB
  • sloc: ml: 8,054; makefile: 18; sh: 11
file content (12 lines) | stat: -rw-r--r-- 344 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
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") |}]
;;