Debian Codegraph @

test/instrument/control/for.t

raw
1 Loop body is instrumented. Condition and bound are not instrumented.
2
3 $ bash ../test.sh <<'EOF'
4 > let _ =
5 > for _index = 0 to 1 do
6 > ()
7 > done
8 > EOF
9 let _ =
10 for _index = 0 to 1 do
11 ___bisect_visit___ 0;
12 ()
13 done
14
15
16 Direction is preserved.
17
18 $ bash ../test.sh <<'EOF'
19 > let _ =
20 > for _index = 1 downto 0 do
21 > ()
22 > done
23 > EOF
24 let _ =
25 for _index = 1 downto 0 do
26 ___bisect_visit___ 0;
27 ()
28 done
29
30
31 Recursive instrumentation of subexpressions.
32
33 $ bash ../test.sh <<'EOF'
34 > let _ =
35 > for _index = (for _i = 0 to 1 do () done); 0
36 > to (for _i = 0 to 1 do () done); 1
37 > do
38 > for _i = 0 to 1 do () done
39 > done
40 > EOF
41 let _ =
42 for
43 _index =
44 for _i = 0 to 1 do
45 ___bisect_visit___ 0;
46 ()
47 done;
48 0
49 to for _i = 0 to 1 do
50 ___bisect_visit___ 1;
51 ()
52 done;
53 1
54 do
55 ___bisect_visit___ 3;
56 for _i = 0 to 1 do
57 ___bisect_visit___ 2;
58 ()
59 done
60 done
61
62
63 Subexpressions not in tail position.
64
65 $ bash ../test.sh <<'EOF'
66 > let _ =
67 > for _index = int_of_string "0" to int_of_string "1" do
68 > print_endline "foo"
69 > done
70 > EOF
71 let _ =
72 for
73 _index = ___bisect_post_visit___ 0 (int_of_string "0")
74 to ___bisect_post_visit___ 1 (int_of_string "1")
75 do
76 ___bisect_visit___ 3;
77 ___bisect_post_visit___ 2 (print_endline "foo")
78 done