Debian Codegraph @

test/instrument/control/function.t

raw
1 Instrumentation of cases.
2
3 $ bash ../test.sh <<'EOF'
4 > let _ =
5 > function
6 > | 0 -> ()
7 > | _ -> ()
8 > EOF
9 let _ = function
10 | 0 ->
11 ___bisect_visit___ 0;
12 ()
13 | _ ->
14 ___bisect_visit___ 1;
15 ()
16
17
18 Recursive instrumentation of cases.
19
20 $ bash ../test.sh <<'EOF'
21 > let _ = function () -> function () -> ()
22 > EOF
23 let _ = function
24 | () -> (
25 ___bisect_visit___ 1;
26 function
27 | () ->
28 ___bisect_visit___ 0;
29 ())
30
31
32 Instrumentation suppressed "between arguments."
33
34 $ bash ../test.sh <<'EOF'
35 > let _ = fun () -> function () -> ()
36 > EOF
37 let _ =
38 fun () -> function
39 | () ->
40 ___bisect_visit___ 0;
41 ()
42
43
44 Expressions in cases are in tail position.
45
46 $ bash ../test.sh <<'EOF'
47 > let _ = function () -> print_endline "foo"
48 > EOF
49 let _ = function
50 | () ->
51 ___bisect_visit___ 0;
52 print_endline "foo"
53
54
55 Or-pattern.
56
57 $ bash ../test.sh <<'EOF'
58 > let _ = function None | Some _ -> print_endline "foo"
59 > EOF
60 let _ =
61 fun ___bisect_matched_value___ ->
62 match ___bisect_matched_value___ with
63 | None | Some _ ->
64 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
65 ___bisect_matched_value___
66 with
67 | None ->
68 ___bisect_visit___ 0;
69 ()
70 | Some _ ->
71 ___bisect_visit___ 1;
72 ()
73 | _ -> ());
74 print_endline "foo"
75
76
77 Or-pattern with polymorphic variants.
78
79 $ bash ../test.sh <<'EOF'
80 > let _ = function `A | `B -> print_endline "foo"
81 > EOF
82 let _ = function
83 | (`A | `B) as ___bisect_matched_value___ ->
84 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
85 ___bisect_matched_value___
86 with
87 | `A ->
88 ___bisect_visit___ 0;
89 ()
90 | `B ->
91 ___bisect_visit___ 1;
92 ()
93 | _ -> ());
94 print_endline "foo"