Debian Codegraph @

test/instrument/recent/refutation.t

raw
1 Refutation cases must not be instrumented in order to still be recognized by the
2 compiler.
3
4 $ bash ../test.sh <<'EOF'
5 > let _ =
6 > match `A with
7 > | `A | `B -> ()
8 > | `A | `B -> .
9 > EOF
10 let _ =
11 match `A with
12 | (`A | `B) as ___bisect_matched_value___ ->
13 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
14 ___bisect_matched_value___
15 with
16 | `A ->
17 ___bisect_visit___ 0;
18 ()
19 | `B ->
20 ___bisect_visit___ 1;
21 ()
22 | _ -> ());
23 ()
24 | `A | `B -> .
25
26
27 assert false gets special treatment by the compiler and must not be
28 instrumented.
29
30 $ bash ../test.sh <<'EOF'
31 > let _ =
32 > match `A with
33 > | `A | `B -> ()
34 > | `C | `D -> assert false
35 > EOF
36 let _ =
37 match `A with
38 | (`A | `B) as ___bisect_matched_value___ ->
39 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
40 ___bisect_matched_value___
41 with
42 | `A ->
43 ___bisect_visit___ 0;
44 ()
45 | `B ->
46 ___bisect_visit___ 1;
47 ()
48 | _ -> ());
49 ()
50 | `C | `D -> assert false
51
52
53 assert false exception cases don't get instrumented.
54
55 $ bash ../test.sh <<'EOF'
56 > let _ =
57 > match `A with
58 > | `A -> ()
59 > | exception Not_found -> assert false
60 > | exception Invalid_argument _ | exception Exit -> assert false
61 > EOF
62 let _ =
63 match `A with
64 | exception Not_found -> assert false
65 | (exception Invalid_argument _) | (exception Exit) -> assert false
66 | `A ->
67 ___bisect_visit___ 0;
68 ()