jobjo / popper

Property-based testing at ease
ISC License
43 stars 1 forks source link

Does not catch unhandled exceptions? #71

Open anentropic opened 1 year ago

anentropic commented 1 year ago

I have a function I want to test which may raise Not_found

I have a test like:

let test_sample =
  test @@ fun () ->
    let* points = Sample.(list int) in
    let result = MyModule.my_func points in
    equal Comparator.int result [1;2;3]

When I run this as part of a test suite I just get this:

$ dune test
File "tests/dune", line 2, characters 8-14:
2 |  (names mytests)
            ^^^^^^
Fatal error: exception Not_found

I was expecting the test framework to catch and report unhandled exceptions - in a big test suite it's not clear which test has failed, or where.

I can add my own try/with in the test case but I was just wondering if this is expected behaviour or not?