5 @INC = ('../lib', '../ext/B/t');
7 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
8 print "1..0 # Skip -- Perl configured without B module\n";
11 if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
13 "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n";
20 # import checkOptree(), and %gOpts (containing test state)
21 use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!!
26 require_ok("B::Concise");
29 switches => ["-MO=Concise,BEGIN,CHECK,INIT,END,-exec"],
30 prog => q{$a=$b && print q/foo/},
35 my $src = q[our ($beg, $chk, $init, $end) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ }];
39 checkOptree ( name => 'BEGIN',
42 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
44 # b <1> leavesub[1 ref] K/REFC,1 ->(end)
45 # - <@> lineseq KP ->b
46 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
47 # 3 <1> require sK/1 ->4
48 # 2 <$> const[PV "strict.pm"] s/BARE ->3
49 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
51 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
52 # a <1> entersub[t1] KS*/TARG,2 ->b
53 # 6 <0> pushmark s ->7
54 # 7 <$> const[PV "strict"] sM ->8
55 # 8 <$> const[PV "refs"] sM ->9
56 # 9 <$> method_named[PVIV 1520340202] ->a
58 # m <1> leavesub[1 ref] K/REFC,1 ->(end)
59 # - <@> lineseq KP ->m
60 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
61 # e <1> require sK/1 ->f
62 # d <$> const[PV "warnings.pm"] s/BARE ->e
63 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
65 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
66 # l <1> entersub[t1] KS*/TARG,2 ->m
67 # h <0> pushmark s ->i
68 # i <$> const[PV "warnings"] sM ->j
69 # j <$> const[PV "qw"] sM ->k
70 # k <$> method_named[PVIV 1520340202] ->l
72 # q <1> leavesub[1 ref] K/REFC,1 ->(end)
73 # - <@> lineseq KP ->q
74 # n <;> nextstate(main 2 -e:3) v ->o
75 # p <1> postinc[t3] sK/1 ->q
76 # - <1> ex-rv2sv sKRM/1 ->p
77 # o <#> gvsv[*beg] s ->p
80 # b <1> leavesub[1 ref] K/REFC,1 ->(end)
81 # - <@> lineseq KP ->b
82 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
83 # 3 <1> require sK/1 ->4
84 # 2 <$> const(PV "strict.pm") s/BARE ->3
85 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
87 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
88 # a <1> entersub[t1] KS*/TARG,2 ->b
89 # 6 <0> pushmark s ->7
90 # 7 <$> const(PV "strict") sM ->8
91 # 8 <$> const(PV "refs") sM ->9
92 # 9 <$> method_named(PVIV 1520340202) ->a
94 # m <1> leavesub[1 ref] K/REFC,1 ->(end)
95 # - <@> lineseq KP ->m
96 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
97 # e <1> require sK/1 ->f
98 # d <$> const(PV "warnings.pm") s/BARE ->e
99 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
100 # - <@> lineseq K ->-
101 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
102 # l <1> entersub[t1] KS*/TARG,2 ->m
103 # h <0> pushmark s ->i
104 # i <$> const(PV "warnings") sM ->j
105 # j <$> const(PV "qw") sM ->k
106 # k <$> method_named(PVIV 1520340202) ->l
108 # q <1> leavesub[1 ref] K/REFC,1 ->(end)
109 # - <@> lineseq KP ->q
110 # n <;> nextstate(main 2 -e:3) v ->o
111 # p <1> postinc[t2] sK/1 ->q
112 # - <1> ex-rv2sv sKRM/1 ->p
113 # o <$> gvsv(*beg) s ->p
117 checkOptree ( name => 'END',
120 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
122 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
123 # - <@> lineseq KP ->4
124 # 1 <;> nextstate(main 5 -e:6) v ->2
125 # 3 <1> postinc[t3] sK/1 ->4
126 # - <1> ex-rv2sv sKRM/1 ->3
127 # 2 <#> gvsv[*end] s ->3
130 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
131 # - <@> lineseq KP ->4
132 # 1 <;> nextstate(main 5 -e:6) v ->2
133 # 3 <1> postinc[t2] sK/1 ->4
134 # - <1> ex-rv2sv sKRM/1 ->3
135 # 2 <$> gvsv(*end) s ->3
139 checkOptree ( name => 'CHECK',
142 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
144 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
145 # - <@> lineseq KP ->4
146 # 1 <;> nextstate(main 3 -e:4) v ->2
147 # 3 <1> postinc[t3] sK/1 ->4
148 # - <1> ex-rv2sv sKRM/1 ->3
149 # 2 <#> gvsv[*chk] s ->3
152 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
153 # - <@> lineseq KP ->4
154 # 1 <;> nextstate(main 3 -e:4) v ->2
155 # 3 <1> postinc[t2] sK/1 ->4
156 # - <1> ex-rv2sv sKRM/1 ->3
157 # 2 <$> gvsv(*chk) s ->3
161 checkOptree ( name => 'INIT',
163 #todo => 'get working',
165 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
167 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
168 # - <@> lineseq KP ->4
169 # 1 <;> nextstate(main 4 -e:5) v ->2
170 # 3 <1> postinc[t3] sK/1 ->4
171 # - <1> ex-rv2sv sKRM/1 ->3
172 # 2 <#> gvsv[*init] s ->3
175 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
176 # - <@> lineseq KP ->4
177 # 1 <;> nextstate(main 4 -e:5) v ->2
178 # 3 <1> postinc[t2] sK/1 ->4
179 # - <1> ex-rv2sv sKRM/1 ->3
180 # 2 <$> gvsv(*init) s ->3
184 checkOptree ( name => 'all of BEGIN END INIT CHECK -exec',
185 bcopts => [qw/ BEGIN END INIT CHECK -exec /],
186 #todo => 'get working',
188 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
190 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
191 # 2 <$> const[PV "strict.pm"] s/BARE
193 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
194 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
196 # 7 <$> const[PV "strict"] sM
197 # 8 <$> const[PV "refs"] sM
198 # 9 <$> method_named[PVIV 1520340202]
199 # a <1> entersub[t1] KS*/TARG,2
200 # b <1> leavesub[1 ref] K/REFC,1
202 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
203 # d <$> const[PV "warnings.pm"] s/BARE
205 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
206 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2
208 # i <$> const[PV "warnings"] sM
209 # j <$> const[PV "qw"] sM
210 # k <$> method_named[PVIV 1520340202]
211 # l <1> entersub[t1] KS*/TARG,2
212 # m <1> leavesub[1 ref] K/REFC,1
214 # n <;> nextstate(main 2 -e:3) v
216 # p <1> postinc[t3] sK/1
217 # q <1> leavesub[1 ref] K/REFC,1
219 # r <;> nextstate(main 5 -e:6) v
221 # t <1> postinc[t3] sK/1
222 # u <1> leavesub[1 ref] K/REFC,1
224 # v <;> nextstate(main 4 -e:5) v
225 # w <#> gvsv[*init] s
226 # x <1> postinc[t3] sK/1
227 # y <1> leavesub[1 ref] K/REFC,1
229 # z <;> nextstate(main 3 -e:4) v
230 # 10 <#> gvsv[*chk] s
231 # 11 <1> postinc[t3] sK/1
232 # 12 <1> leavesub[1 ref] K/REFC,1
235 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
236 # 2 <$> const(PV "strict.pm") s/BARE
238 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
239 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
241 # 7 <$> const(PV "strict") sM
242 # 8 <$> const(PV "refs") sM
243 # 9 <$> method_named(PVIV 1520340202)
244 # a <1> entersub[t1] KS*/TARG,2
245 # b <1> leavesub[1 ref] K/REFC,1
247 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
248 # d <$> const(PV "warnings.pm") s/BARE
250 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
251 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2
253 # i <$> const(PV "warnings") sM
254 # j <$> const(PV "qw") sM
255 # k <$> method_named(PVIV 1520340202)
256 # l <1> entersub[t1] KS*/TARG,2
257 # m <1> leavesub[1 ref] K/REFC,1
259 # n <;> nextstate(main 2 -e:3) v
261 # p <1> postinc[t2] sK/1
262 # q <1> leavesub[1 ref] K/REFC,1
264 # r <;> nextstate(main 5 -e:6) v
266 # t <1> postinc[t2] sK/1
267 # u <1> leavesub[1 ref] K/REFC,1
269 # v <;> nextstate(main 4 -e:5) v
270 # w <$> gvsv(*init) s
271 # x <1> postinc[t2] sK/1
272 # y <1> leavesub[1 ref] K/REFC,1
274 # z <;> nextstate(main 3 -e:4) v
275 # 10 <$> gvsv(*chk) s
276 # 11 <1> postinc[t2] sK/1
277 # 12 <1> leavesub[1 ref] K/REFC,1