jobjo / popper

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

Exception backtraces are not preserved #69

Open copy opened 2 years ago

copy commented 2 years ago

The following code:

open Popper
let () =
  Printexc.record_backtrace true;
  run (test (fun () ->
      failwith "XXX"
    ))

Prints:

0/1 tests passed and 1 failed in 0.00s:

  ✖  Anonymous  Failed  0ms  

┌────────────────────────────────────────────────────────────────────────────────────────┐
│ Failed                                                                                 │
└────────────────────────────────────────────────────────────────────────────────────────┘

  Reason:

    Failure("XXX")

Test Failed: 0/1 tests passed and 1 failed in 0.00s.

Fatal error: exception Popper.Test_failure
Raised at Popper.run in file "src/lib/popper.ml", line 42, characters 4-22
Called from Dune__exe__Test in file "test.ml", line 4, characters 2-50

The backtrace is missing, making the debugging of exceptions (especially generic ones like Invalid_argument) quite difficult.

jobjo commented 2 years ago

Yeah, that's a good point. I think we could report backtraces as well. Will take a look