Skip to content

Commit fb150c6

Browse files
committed
Add an internal test for Lin on uncaught exceptions
1 parent c7aa7ac commit fb150c6

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

test/dune

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,12 @@
5454
(libraries qcheck-stm.sequential threads.posix)
5555
(action
5656
(with-accepted-exit-codes 1 (run ./%{test} --verbose --seed 229109553))))
57+
58+
(test
59+
(name uncaught_lin)
60+
(package qcheck-lin)
61+
(modules uncaught_lin)
62+
(libraries qcheck-lin.domain)
63+
(action
64+
(with-accepted-exit-codes 1
65+
(run %{test} --verbose --seed 260395858))))

test/uncaught_lin.expected

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
random seed: 260395858
2+
generated error fail pass / total time test name
3+
[ ] 0 0 0 0 / 10 0.0s Lin DSL test of uncaught exceptions[ ] 0 0 0 0 / 10 0.0s Lin DSL test of uncaught exceptions (generating)[✗] 1 1 0 0 / 10 0.0s Lin DSL test of uncaught exceptions
4+
[ ] 0 0 0 0 / 10 0.0s neg Lin DSL test of uncaught exceptions[✗] 1 1 0 0 / 10 0.0s neg Lin DSL test of uncaught exceptions
5+
6+
=== Error ======================================================================
7+
8+
Test Lin DSL test of uncaught exceptions errored on (18 shrink steps):
9+
10+
|
11+
always_fail t
12+
|
13+
.---------------------.
14+
| |
15+
16+
17+
exception Failure("unexpected") raised but not caught while running always_fail t
18+
19+
20+
=== Error ======================================================================
21+
22+
Test neg Lin DSL test of uncaught exceptions errored on (18 shrink steps):
23+
24+
|
25+
always_fail t
26+
|
27+
.---------------------.
28+
| |
29+
30+
31+
exception Failure("unexpected") raised but not caught while running always_fail t
32+
33+
================================================================================
34+
failure (0 tests failed, 2 tests errored, ran 2 tests)

test/uncaught_lin.ml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(* Test of the behaviour of Lin tests with uncaught exceptions *)
2+
3+
let always_fail () = failwith "unexpected"
4+
5+
module UncaughtExcConf = struct
6+
open Lin
7+
8+
type t = unit
9+
10+
let init () = ()
11+
let cleanup _ = ()
12+
let api = [ val_ "always_fail" always_fail (t @-> returning unit) ]
13+
end
14+
15+
module UncaughtExc_domain = Lin_domain.Make (UncaughtExcConf)
16+
17+
let _ =
18+
QCheck_base_runner.run_tests_main
19+
[
20+
UncaughtExc_domain.lin_test ~count:10
21+
~name:"Lin DSL test of uncaught exceptions";
22+
UncaughtExc_domain.neg_lin_test ~count:10
23+
~name:"neg Lin DSL test of uncaught exceptions";
24+
]

0 commit comments

Comments
 (0)