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::Config{'extensions'} !~ /\bData\/Dumper\b/) {
13 "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n";
19 # import checkOptree(), and %gOpts (containing test state)
20 use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!!
25 require_ok("B::Concise");
28 switches => ["-MO=Concise,BEGIN,CHECK,INIT,END,-exec"],
29 prog => q{$a=$b && print q/foo/},
34 my $src = q[our ($beg, $chk, $init, $end) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ }];
38 checkOptree ( name => 'BEGIN',
41 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
43 # b <1> leavesub[1 ref] K/REFC,1 ->(end)
44 # - <@> lineseq KP ->b
45 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
46 # 3 <1> require sK/1 ->4
47 # 2 <$> const[PV "strict.pm"] s/BARE ->3
48 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
50 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
51 # a <1> entersub[t1] KS*/TARG,2 ->b
52 # 6 <0> pushmark s ->7
53 # 7 <$> const[PV "strict"] sM ->8
54 # 8 <$> const[PV "refs"] sM ->9
55 # 9 <$> method_named[PVIV 1520340202] ->a
57 # m <1> leavesub[1 ref] K/REFC,1 ->(end)
58 # - <@> lineseq KP ->m
59 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
60 # e <1> require sK/1 ->f
61 # d <$> const[PV "warnings.pm"] s/BARE ->e
62 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
64 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
65 # l <1> entersub[t1] KS*/TARG,2 ->m
66 # h <0> pushmark s ->i
67 # i <$> const[PV "warnings"] sM ->j
68 # j <$> const[PV "qw"] sM ->k
69 # k <$> method_named[PVIV 1520340202] ->l
71 # q <1> leavesub[1 ref] K/REFC,1 ->(end)
72 # - <@> lineseq KP ->q
73 # n <;> nextstate(main 2 -e:3) v ->o
74 # p <1> postinc[t3] sK/1 ->q
75 # - <1> ex-rv2sv sKRM/1 ->p
76 # o <#> gvsv[*beg] s ->p
79 # b <1> leavesub[1 ref] K/REFC,1 ->(end)
80 # - <@> lineseq KP ->b
81 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
82 # 3 <1> require sK/1 ->4
83 # 2 <$> const(PV "strict.pm") s/BARE ->3
84 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
86 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
87 # a <1> entersub[t1] KS*/TARG,2 ->b
88 # 6 <0> pushmark s ->7
89 # 7 <$> const(PV "strict") sM ->8
90 # 8 <$> const(PV "refs") sM ->9
91 # 9 <$> method_named(PVIV 1520340202) ->a
93 # m <1> leavesub[1 ref] K/REFC,1 ->(end)
94 # - <@> lineseq KP ->m
95 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
96 # e <1> require sK/1 ->f
97 # d <$> const(PV "warnings.pm") s/BARE ->e
98 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
100 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
101 # l <1> entersub[t1] KS*/TARG,2 ->m
102 # h <0> pushmark s ->i
103 # i <$> const(PV "warnings") sM ->j
104 # j <$> const(PV "qw") sM ->k
105 # k <$> method_named(PVIV 1520340202) ->l
107 # q <1> leavesub[1 ref] K/REFC,1 ->(end)
108 # - <@> lineseq KP ->q
109 # n <;> nextstate(main 2 -e:3) v ->o
110 # p <1> postinc[t2] sK/1 ->q
111 # - <1> ex-rv2sv sKRM/1 ->p
112 # o <$> gvsv(*beg) s ->p
116 checkOptree ( name => 'END',
119 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
121 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
122 # - <@> lineseq KP ->4
123 # 1 <;> nextstate(main 5 -e:6) v ->2
124 # 3 <1> postinc[t3] sK/1 ->4
125 # - <1> ex-rv2sv sKRM/1 ->3
126 # 2 <#> gvsv[*end] s ->3
129 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
130 # - <@> lineseq KP ->4
131 # 1 <;> nextstate(main 5 -e:6) v ->2
132 # 3 <1> postinc[t2] sK/1 ->4
133 # - <1> ex-rv2sv sKRM/1 ->3
134 # 2 <$> gvsv(*end) s ->3
138 checkOptree ( name => 'CHECK',
141 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
143 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
144 # - <@> lineseq KP ->4
145 # 1 <;> nextstate(main 3 -e:4) v ->2
146 # 3 <1> postinc[t3] sK/1 ->4
147 # - <1> ex-rv2sv sKRM/1 ->3
148 # 2 <#> gvsv[*chk] s ->3
151 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
152 # - <@> lineseq KP ->4
153 # 1 <;> nextstate(main 3 -e:4) v ->2
154 # 3 <1> postinc[t2] sK/1 ->4
155 # - <1> ex-rv2sv sKRM/1 ->3
156 # 2 <$> gvsv(*chk) s ->3
160 checkOptree ( name => 'INIT',
162 #todo => 'get working',
164 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
166 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
167 # - <@> lineseq KP ->4
168 # 1 <;> nextstate(main 4 -e:5) v ->2
169 # 3 <1> postinc[t3] sK/1 ->4
170 # - <1> ex-rv2sv sKRM/1 ->3
171 # 2 <#> gvsv[*init] s ->3
174 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
175 # - <@> lineseq KP ->4
176 # 1 <;> nextstate(main 4 -e:5) v ->2
177 # 3 <1> postinc[t2] sK/1 ->4
178 # - <1> ex-rv2sv sKRM/1 ->3
179 # 2 <$> gvsv(*init) s ->3
183 checkOptree ( name => 'all of BEGIN END INIT CHECK -exec',
184 bcopts => [qw/ BEGIN END INIT CHECK -exec /],
185 #todo => 'get working',
187 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
189 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
190 # 2 <$> const[PV "strict.pm"] s/BARE
192 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
193 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
195 # 7 <$> const[PV "strict"] sM
196 # 8 <$> const[PV "refs"] sM
197 # 9 <$> method_named[PVIV 1520340202]
198 # a <1> entersub[t1] KS*/TARG,2
199 # b <1> leavesub[1 ref] K/REFC,1
201 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
202 # d <$> const[PV "warnings.pm"] s/BARE
204 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
205 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2
207 # i <$> const[PV "warnings"] sM
208 # j <$> const[PV "qw"] sM
209 # k <$> method_named[PVIV 1520340202]
210 # l <1> entersub[t1] KS*/TARG,2
211 # m <1> leavesub[1 ref] K/REFC,1
213 # n <;> nextstate(main 2 -e:3) v
215 # p <1> postinc[t3] sK/1
216 # q <1> leavesub[1 ref] K/REFC,1
218 # r <;> nextstate(main 5 -e:6) v
220 # t <1> postinc[t3] sK/1
221 # u <1> leavesub[1 ref] K/REFC,1
223 # v <;> nextstate(main 4 -e:5) v
224 # w <#> gvsv[*init] s
225 # x <1> postinc[t3] sK/1
226 # y <1> leavesub[1 ref] K/REFC,1
228 # z <;> nextstate(main 3 -e:4) v
229 # 10 <#> gvsv[*chk] s
230 # 11 <1> postinc[t3] sK/1
231 # 12 <1> leavesub[1 ref] K/REFC,1
234 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
235 # 2 <$> const(PV "strict.pm") s/BARE
237 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
238 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
240 # 7 <$> const(PV "strict") sM
241 # 8 <$> const(PV "refs") sM
242 # 9 <$> method_named(PVIV 1520340202)
243 # a <1> entersub[t1] KS*/TARG,2
244 # b <1> leavesub[1 ref] K/REFC,1
246 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
247 # d <$> const(PV "warnings.pm") s/BARE
249 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
250 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2
252 # i <$> const(PV "warnings") sM
253 # j <$> const(PV "qw") sM
254 # k <$> method_named(PVIV 1520340202)
255 # l <1> entersub[t1] KS*/TARG,2
256 # m <1> leavesub[1 ref] K/REFC,1
258 # n <;> nextstate(main 2 -e:3) v
260 # p <1> postinc[t2] sK/1
261 # q <1> leavesub[1 ref] K/REFC,1
263 # r <;> nextstate(main 5 -e:6) v
265 # t <1> postinc[t2] sK/1
266 # u <1> leavesub[1 ref] K/REFC,1
268 # v <;> nextstate(main 4 -e:5) v
269 # w <$> gvsv(*init) s
270 # x <1> postinc[t2] sK/1
271 # y <1> leavesub[1 ref] K/REFC,1
273 # z <;> nextstate(main 3 -e:4) v
274 # 10 <$> gvsv(*chk) s
275 # 11 <1> postinc[t2] sK/1
276 # 12 <1> leavesub[1 ref] K/REFC,1