Debian Codegraph @

test/instrument/control/fun.t

raw
1 Instrumentation of internal entry point.
2
3 $ bash ../test.sh <<'EOF'
4 > let _ = fun () -> ()
5 > EOF
6 let _ =
7 fun () ->
8 ___bisect_visit___ 0;
9 ()
10
11
12 Preservation of labeled arguments and their patterns.
13
14 $ bash ../test.sh <<'EOF'
15 > let _ = fun ~l:_ -> ()
16 > EOF
17 let _ =
18 fun ~l:_ ->
19 ___bisect_visit___ 0;
20 ()
21
22
23 Preservation of optional labeled arguments.
24
25 $ bash ../test.sh <<'EOF'
26 > let _ = (fun ?l:_ -> ()) [@ocaml.warning "-16"]
27 > EOF
28 let _ =
29 fun [@ocaml.warning "-16"] ?l:_ ->
30 ___bisect_visit___ 0;
31 ()
32
33
34 Preservation of default values. Instrumentation of entry into default values.
35 Recursive instrumentation of default values.
36
37 $ bash ../test.sh <<'EOF'
38 > let _ = fun ?(l = fun () -> ()) -> l
39 > EOF
40 let _ =
41 fun ?(l =
42 ___bisect_visit___ 1;
43 fun () ->
44 ___bisect_visit___ 0;
45 ()) ->
46 ___bisect_visit___ 2;
47 l
48
49
50 Recursive instrumentation of main subexpression. Instrumentation suppressed on
51 "between arguments."
52
53 $ bash ../test.sh <<'EOF'
54 > let _ = fun () -> fun () -> ()
55 > EOF
56 let _ =
57 fun () () ->
58 ___bisect_visit___ 0;
59 ()
60
61
62 Instrumentation placed correctly if immediate child is a "return type"
63 constraint.
64
65 $ bash ../test.sh <<'EOF'
66 > let _ = fun () -> (() : unit)
67 > EOF
68 let _ =
69 fun () : unit ->
70 ___bisect_visit___ 0;
71 ()
72
73
74 Gentle handling of optional argument elimination. See
75 https://github.com/aantron/bisect_ppx/issues/319.
76
77 $ bash ../test.sh <<'EOF'
78 > let f () ?x () =
79 > x
80 >
81 > let () =
82 > ignore (List.map (f ()) [])
83 > EOF
84 let f () ?x () =
85 ___bisect_visit___ 0;
86 x
87
88 let () =
89 ignore
90 (___bisect_post_visit___ 2 (List.map (___bisect_post_visit___ 1 (f ())) []))
91
92
93 Expressions in default value are not in tail position; expressions in main
94 subexpression are.
95
96 $ bash ../test.sh <<'EOF'
97 > [@@@ocaml.warning "-27"]
98 > let _ =
99 > fun ?(l = print_endline "foo") () -> print_endline "bar"
100 > EOF
101 [@@@ocaml.warning "-27"]
102
103 let _ =
104 fun ?(l =
105 ___bisect_visit___ 1;
106 ___bisect_post_visit___ 0 (print_endline "foo")) () ->
107 ___bisect_visit___ 2;
108 print_endline "bar"