5 @INC = ('../lib', '../ext/B/t');
7 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
8 print "1..0 # Skip -- Perl configured without B module\n";
14 # import checkOptree(), and %gOpts (containing test state)
15 use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!!
20 require_ok("B::Concise");
23 switches => ["-MO=Concise,BEGIN,CHECK,INIT,END,-exec"],
24 prog => q{$a=$b && print q/foo/},
29 my $src = q[our ($beg, $chk, $init, $end) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ }];
33 checkOptree ( name => 'BEGIN',
36 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
38 # b <1> leavesub[1 ref] K/REFC,1 ->(end)
39 # - <@> lineseq KP ->b
40 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
41 # 3 <1> require sK/1 ->4
42 # 2 <$> const[PV "strict.pm"] s/BARE ->3
43 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
45 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
46 # a <1> entersub[t1] KS*/TARG,2 ->b
47 # 6 <0> pushmark s ->7
48 # 7 <$> const[PV "strict"] sM ->8
49 # 8 <$> const[PV "refs"] sM ->9
50 # 9 <$> method_named[PVIV 1520340202] ->a
52 # m <1> leavesub[1 ref] K/REFC,1 ->(end)
53 # - <@> lineseq KP ->m
54 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
55 # e <1> require sK/1 ->f
56 # d <$> const[PV "warnings.pm"] s/BARE ->e
57 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
59 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
60 # l <1> entersub[t1] KS*/TARG,2 ->m
61 # h <0> pushmark s ->i
62 # i <$> const[PV "warnings"] sM ->j
63 # j <$> const[PV "qw"] sM ->k
64 # k <$> method_named[PVIV 1520340202] ->l
66 # q <1> leavesub[1 ref] K/REFC,1 ->(end)
67 # - <@> lineseq KP ->q
68 # n <;> nextstate(main 2 -e:3) v ->o
69 # p <1> postinc[t3] sK/1 ->q
70 # - <1> ex-rv2sv sKRM/1 ->p
71 # o <#> gvsv[*beg] s ->p
74 # b <1> leavesub[1 ref] K/REFC,1 ->(end)
75 # - <@> lineseq KP ->b
76 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
77 # 3 <1> require sK/1 ->4
78 # 2 <$> const(PV "strict.pm") s/BARE ->3
79 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
81 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
82 # a <1> entersub[t1] KS*/TARG,2 ->b
83 # 6 <0> pushmark s ->7
84 # 7 <$> const(PV "strict") sM ->8
85 # 8 <$> const(PV "refs") sM ->9
86 # 9 <$> method_named(PVIV 1520340202) ->a
88 # m <1> leavesub[1 ref] K/REFC,1 ->(end)
89 # - <@> lineseq KP ->m
90 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
91 # e <1> require sK/1 ->f
92 # d <$> const(PV "warnings.pm") s/BARE ->e
93 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
95 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
96 # l <1> entersub[t1] KS*/TARG,2 ->m
97 # h <0> pushmark s ->i
98 # i <$> const(PV "warnings") sM ->j
99 # j <$> const(PV "qw") sM ->k
100 # k <$> method_named(PVIV 1520340202) ->l
102 # q <1> leavesub[1 ref] K/REFC,1 ->(end)
103 # - <@> lineseq KP ->q
104 # n <;> nextstate(main 2 -e:3) v ->o
105 # p <1> postinc[t2] sK/1 ->q
106 # - <1> ex-rv2sv sKRM/1 ->p
107 # o <$> gvsv(*beg) s ->p
111 checkOptree ( name => 'END',
114 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
116 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
117 # - <@> lineseq KP ->4
118 # 1 <;> nextstate(main 5 -e:6) v ->2
119 # 3 <1> postinc[t3] sK/1 ->4
120 # - <1> ex-rv2sv sKRM/1 ->3
121 # 2 <#> gvsv[*end] s ->3
124 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
125 # - <@> lineseq KP ->4
126 # 1 <;> nextstate(main 5 -e:6) v ->2
127 # 3 <1> postinc[t2] sK/1 ->4
128 # - <1> ex-rv2sv sKRM/1 ->3
129 # 2 <$> gvsv(*end) s ->3
133 checkOptree ( name => 'CHECK',
136 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
138 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
139 # - <@> lineseq KP ->4
140 # 1 <;> nextstate(main 3 -e:4) v ->2
141 # 3 <1> postinc[t3] sK/1 ->4
142 # - <1> ex-rv2sv sKRM/1 ->3
143 # 2 <#> gvsv[*chk] s ->3
146 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
147 # - <@> lineseq KP ->4
148 # 1 <;> nextstate(main 3 -e:4) v ->2
149 # 3 <1> postinc[t2] sK/1 ->4
150 # - <1> ex-rv2sv sKRM/1 ->3
151 # 2 <$> gvsv(*chk) s ->3
155 checkOptree ( name => 'INIT',
157 #todo => 'get working',
159 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
161 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
162 # - <@> lineseq KP ->4
163 # 1 <;> nextstate(main 4 -e:5) v ->2
164 # 3 <1> postinc[t3] sK/1 ->4
165 # - <1> ex-rv2sv sKRM/1 ->3
166 # 2 <#> gvsv[*init] s ->3
169 # 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
170 # - <@> lineseq KP ->4
171 # 1 <;> nextstate(main 4 -e:5) v ->2
172 # 3 <1> postinc[t2] sK/1 ->4
173 # - <1> ex-rv2sv sKRM/1 ->3
174 # 2 <$> gvsv(*init) s ->3
178 checkOptree ( name => 'all of BEGIN END INIT CHECK -exec',
179 bcopts => [qw/ BEGIN END INIT CHECK -exec /],
180 #todo => 'get working',
182 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
184 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
185 # 2 <$> const[PV "strict.pm"] s/BARE
187 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
188 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
190 # 7 <$> const[PV "strict"] sM
191 # 8 <$> const[PV "refs"] sM
192 # 9 <$> method_named[PVIV 1520340202]
193 # a <1> entersub[t1] KS*/TARG,2
194 # b <1> leavesub[1 ref] K/REFC,1
196 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
197 # d <$> const[PV "warnings.pm"] s/BARE
199 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
200 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2
202 # i <$> const[PV "warnings"] sM
203 # j <$> const[PV "qw"] sM
204 # k <$> method_named[PVIV 1520340202]
205 # l <1> entersub[t1] KS*/TARG,2
206 # m <1> leavesub[1 ref] K/REFC,1
208 # n <;> nextstate(main 2 -e:3) v
210 # p <1> postinc[t3] sK/1
211 # q <1> leavesub[1 ref] K/REFC,1
213 # r <;> nextstate(main 5 -e:6) v
215 # t <1> postinc[t3] sK/1
216 # u <1> leavesub[1 ref] K/REFC,1
218 # v <;> nextstate(main 4 -e:5) v
219 # w <#> gvsv[*init] s
220 # x <1> postinc[t3] sK/1
221 # y <1> leavesub[1 ref] K/REFC,1
223 # z <;> nextstate(main 3 -e:4) v
224 # 10 <#> gvsv[*chk] s
225 # 11 <1> postinc[t3] sK/1
226 # 12 <1> leavesub[1 ref] K/REFC,1
229 # 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
230 # 2 <$> const(PV "strict.pm") s/BARE
232 # 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
233 # 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
235 # 7 <$> const(PV "strict") sM
236 # 8 <$> const(PV "refs") sM
237 # 9 <$> method_named(PVIV 1520340202)
238 # a <1> entersub[t1] KS*/TARG,2
239 # b <1> leavesub[1 ref] K/REFC,1
241 # c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
242 # d <$> const(PV "warnings.pm") s/BARE
244 # f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
245 # g <;> nextstate(B::Concise -227 Concise.pm:327) /2
247 # i <$> const(PV "warnings") sM
248 # j <$> const(PV "qw") sM
249 # k <$> method_named(PVIV 1520340202)
250 # l <1> entersub[t1] KS*/TARG,2
251 # m <1> leavesub[1 ref] K/REFC,1
253 # n <;> nextstate(main 2 -e:3) v
255 # p <1> postinc[t2] sK/1
256 # q <1> leavesub[1 ref] K/REFC,1
258 # r <;> nextstate(main 5 -e:6) v
260 # t <1> postinc[t2] sK/1
261 # u <1> leavesub[1 ref] K/REFC,1
263 # v <;> nextstate(main 4 -e:5) v
264 # w <$> gvsv(*init) s
265 # x <1> postinc[t2] sK/1
266 # y <1> leavesub[1 ref] K/REFC,1
268 # z <;> nextstate(main 3 -e:4) v
269 # 10 <$> gvsv(*chk) s
270 # 11 <1> postinc[t2] sK/1
271 # 12 <1> leavesub[1 ref] K/REFC,1