Debian Codegraph @

test/instrument/control/try.t

raw
1 Instrumentation of cases. No instrumentation of main subexpression.
2
3 $ bash ../test.sh <<'EOF'
4 > let _ =
5 > try ()
6 > with
7 > | Exit -> ()
8 > | Failure _ -> ()
9 > EOF
10 let _ =
11 try () with
12 | Exit ->
13 ___bisect_visit___ 0;
14 ()
15 | Failure _ ->
16 ___bisect_visit___ 1;
17 ()
18
19
20 Recursive instrumentation of subexpressions.
21
22 $ bash ../test.sh <<'EOF'
23 > let _ =
24 > try
25 > try () with _ -> ()
26 > with _ ->
27 > try () with _ -> ()
28 > EOF
29 let _ =
30 try
31 try ()
32 with _ ->
33 ___bisect_visit___ 2;
34 ()
35 with _ -> (
36 ___bisect_visit___ 1;
37 try ()
38 with _ ->
39 ___bisect_visit___ 0;
40 ())
41
42
43 Main subexpression is not in tail position. Handler is in tail position iff the
44 whole expression is in tail position.
45
46 $ bash ../test.sh <<'EOF'
47 > let _ =
48 > try print_endline "foo" with _ -> print_endline "bar"
49 > let _ = fun () ->
50 > try print_endline "foo" with _ -> print_endline "bar"
51 > EOF
52 let _ =
53 try ___bisect_post_visit___ 2 (print_endline "foo")
54 with _ ->
55 ___bisect_visit___ 1;
56 ___bisect_post_visit___ 0 (print_endline "bar")
57
58 let _ =
59 fun () ->
60 ___bisect_visit___ 5;
61 try ___bisect_post_visit___ 4 (print_endline "foo")
62 with _ ->
63 ___bisect_visit___ 3;
64 print_endline "bar"
65
66
67 Or-pattern.
68
69 $ bash ../test.sh <<'EOF'
70 > let _ =
71 > try ()
72 > with Exit | End_of_file -> ()
73 > EOF
74 let _ =
75 try ()
76 with (Exit | End_of_file) as ___bisect_matched_value___ ->
77 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
78 ___bisect_matched_value___
79 with
80 | Exit ->
81 ___bisect_visit___ 0;
82 ()
83 | End_of_file ->
84 ___bisect_visit___ 1;
85 ()
86 | _ -> ());
87 ()