This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove unnecessary module loads from B and O
[perl5.git] / ext / B / t / optree_specials.t
CommitLineData
cc02ea56
JC
1#!./perl
2
09e96b99
JC
3# This tests the B:: module(s) with CHECK, BEGIN, END and INIT blocks. The
4# text excerpts below marked with "# " in front are the expected output. They
5# are there twice, EOT for threading, and EONT for a non-threading Perl. The
6# output is matched losely. If the match fails even though the "got" and
7# "expected" output look exactly the same, then watch for trailing, invisible
8# spaces.
9
cc02ea56 10BEGIN {
74517a3a 11 unshift @INC, 't';
9cd8f857
NC
12 require Config;
13 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
14 print "1..0 # Skip -- Perl configured without B module\n";
15 exit 0;
16 }
cc02ea56
JC
17}
18
19# import checkOptree(), and %gOpts (containing test state)
20use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!!
21use Config;
22
35633035 23plan tests => 15;
cc02ea56
JC
24
25require_ok("B::Concise");
26
27my $out = runperl(
28 switches => ["-MO=Concise,BEGIN,CHECK,INIT,END,-exec"],
29 prog => q{$a=$b && print q/foo/},
30 stderr => 1 );
31
32#print "out:$out\n";
33
676456c2 34my $src = q[our ($beg, $chk, $init, $end, $uc) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ } UNITCHECK {$uc++}];
cc02ea56
JC
35
36
cc02ea56
JC
37checkOptree ( name => 'BEGIN',
38 bcopts => 'BEGIN',
39 prog => $src,
be2b1c74 40 strip_open_hints => 1,
cc02ea56 41 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
95d444af
TR
42# - <@> lineseq KP ->7
43# 1 <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$ ->2
44# 6 <2> sassign sKS/2 ->7
45# 4 <1> srefgen sK/1 ->5
46# - <1> ex-list lKRM ->4
47# 3 <1> rv2gv sKRM/STRICT,1 ->4
48# 2 <#> gv[*STDOUT] s ->3
49# - <1> ex-rv2sv sKRM*/STRICT,1 ->6
50# 5 <#> gvsv[*B::Concise::walkHandle] s ->6
cc02ea56 51# BEGIN 2:
95d444af
TR
52# h <1> leavesub[1 ref] K/REFC,1 ->(end)
53# - <@> lineseq K ->h
54# 8 <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->9
55# a <1> require sK/1 ->b
56# 9 <$> const[PV "strict.pm"] s/BARE ->a
57# - <;> ex-nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->b
9e0f9750 58# - <@> lineseq K ->-
95d444af
TR
59# b <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$ ->c
60# g <1> entersub[t1] KRS*/TARG,STRICT ->h
61# c <0> pushmark s ->d
62# d <$> const[PV "strict"] sM ->e
63# e <$> const[PV "refs"] sM ->f
64# f <.> method_named[PV "unimport"] ->g
9e0f9750 65# BEGIN 3:
95d444af
TR
66# r <1> leavesub[1 ref] K/REFC,1 ->(end)
67# - <@> lineseq K ->r
68# i <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->j
69# k <1> require sK/1 ->l
70# j <$> const[PV "strict.pm"] s/BARE ->k
71# - <;> ex-nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->l
9e0f9750 72# - <@> lineseq K ->-
95d444af
TR
73# l <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$ ->m
74# q <1> entersub[t1] KRS*/TARG,STRICT ->r
75# m <0> pushmark s ->n
76# n <$> const[PV "strict"] sM ->o
77# o <$> const[PV "refs"] sM ->p
78# p <.> method_named[PV "unimport"] ->q
9e0f9750 79# BEGIN 4:
95d444af
TR
80# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
81# - <@> lineseq KP ->11
82# s <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->t
83# u <1> require sK/1 ->v
84# t <$> const[PV "strict.pm"] s/BARE ->u
85# - <;> ex-nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->v
86# - <@> lineseq K ->-
87# v <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$ ->w
88# 10 <1> entersub[t1] KRS*/TARG,STRICT ->11
89# w <0> pushmark s ->x
90# x <$> const[PV "strict"] sM ->y
91# y <$> const[PV "refs"] sM ->z
92# z <.> method_named[PV "unimport"] ->10
93# BEGIN 5:
94# 1b <1> leavesub[1 ref] K/REFC,1 ->(end)
95# - <@> lineseq K ->1b
96# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->13
97# 14 <1> require sK/1 ->15
98# 13 <$> const[PV "strict.pm"] s/BARE ->14
99# - <;> ex-nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->15
100# - <@> lineseq K ->-
101# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$ ->16
102# 1a <1> entersub[t1] KRS*/TARG,STRICT ->1b
103# 16 <0> pushmark s ->17
104# 17 <$> const[PV "strict"] sM ->18
105# 18 <$> const[PV "refs"] sM ->19
106# 19 <.> method_named[PV "unimport"] ->1a
107# BEGIN 6:
108# 1l <1> leavesub[1 ref] K/REFC,1 ->(end)
109# - <@> lineseq KP ->1l
110# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1d
111# 1e <1> require sK/1 ->1f
112# 1d <$> const[PV "warnings.pm"] s/BARE ->1e
113# - <;> ex-nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1f
114# - <@> lineseq K ->-
115# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$ ->1g
116# 1k <1> entersub[t1] KRS*/TARG,STRICT ->1l
117# 1g <0> pushmark s ->1h
118# 1h <$> const[PV "warnings"] sM ->1i
119# 1i <$> const[PV "qw"] sM ->1j
120# 1j <.> method_named[PV "unimport"] ->1k
121# BEGIN 7:
122# 1p <1> leavesub[1 ref] K/REFC,1 ->(end)
123# - <@> lineseq KP ->1p
124# 1m <;> nextstate(main 3 -e:1) v:{ ->1n
125# 1o <1> postinc[t3] sK/1 ->1p
126# - <1> ex-rv2sv sKRM/1 ->1o
127# 1n <#> gvsv[*beg] s ->1o
cc02ea56
JC
128EOT_EOT
129# BEGIN 1:
95d444af
TR
130# 7 <1> leavesub[1 ref] K/REFC,1 ->(end)
131# - <@> lineseq KP ->7
132# 1 <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$ ->2
133# 6 <2> sassign sKS/2 ->7
134# 4 <1> srefgen sK/1 ->5
135# - <1> ex-list lKRM ->4
136# 3 <1> rv2gv sKRM/STRICT,1 ->4
137# 2 <$> gv(*STDOUT) s ->3
138# - <1> ex-rv2sv sKRM*/STRICT,1 ->6
139# 5 <$> gvsv(*B::Concise::walkHandle) s ->6
cc02ea56 140# BEGIN 2:
95d444af
TR
141# h <1> leavesub[1 ref] K/REFC,1 ->(end)
142# - <@> lineseq K ->h
143# 8 <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->9
144# a <1> require sK/1 ->b
145# 9 <$> const(PV "strict.pm") s/BARE ->a
146# - <;> ex-nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->b
9e0f9750 147# - <@> lineseq K ->-
95d444af
TR
148# b <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$ ->c
149# g <1> entersub[t1] KRS*/TARG,STRICT ->h
150# c <0> pushmark s ->d
151# d <$> const(PV "strict") sM ->e
152# e <$> const(PV "refs") sM ->f
153# f <.> method_named(PV "unimport") ->g
9e0f9750 154# BEGIN 3:
95d444af
TR
155# r <1> leavesub[1 ref] K/REFC,1 ->(end)
156# - <@> lineseq K ->r
157# i <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->j
158# k <1> require sK/1 ->l
159# j <$> const(PV "strict.pm") s/BARE ->k
160# - <;> ex-nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->l
9e0f9750 161# - <@> lineseq K ->-
95d444af
TR
162# l <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$ ->m
163# q <1> entersub[t1] KRS*/TARG,STRICT ->r
164# m <0> pushmark s ->n
165# n <$> const(PV "strict") sM ->o
166# o <$> const(PV "refs") sM ->p
167# p <.> method_named(PV "unimport") ->q
9e0f9750 168# BEGIN 4:
95d444af
TR
169# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
170# - <@> lineseq KP ->11
171# s <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->t
172# u <1> require sK/1 ->v
173# t <$> const(PV "strict.pm") s/BARE ->u
174# - <;> ex-nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->v
175# - <@> lineseq K ->-
176# v <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$ ->w
177# 10 <1> entersub[t1] KRS*/TARG,STRICT ->11
178# w <0> pushmark s ->x
179# x <$> const(PV "strict") sM ->y
180# y <$> const(PV "refs") sM ->z
181# z <.> method_named(PV "unimport") ->10
182# BEGIN 5:
183# 1b <1> leavesub[1 ref] K/REFC,1 ->(end)
184# - <@> lineseq K ->1b
185# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->13
186# 14 <1> require sK/1 ->15
187# 13 <$> const(PV "strict.pm") s/BARE ->14
188# - <;> ex-nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->15
189# - <@> lineseq K ->-
190# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$ ->16
191# 1a <1> entersub[t1] KRS*/TARG,STRICT ->1b
192# 16 <0> pushmark s ->17
193# 17 <$> const(PV "strict") sM ->18
194# 18 <$> const(PV "refs") sM ->19
195# 19 <.> method_named(PV "unimport") ->1a
196# BEGIN 6:
197# 1l <1> leavesub[1 ref] K/REFC,1 ->(end)
198# - <@> lineseq KP ->1l
199# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1d
200# 1e <1> require sK/1 ->1f
201# 1d <$> const(PV "warnings.pm") s/BARE ->1e
202# - <;> ex-nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1f
203# - <@> lineseq K ->-
204# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$ ->1g
205# 1k <1> entersub[t1] KRS*/TARG,STRICT ->1l
206# 1g <0> pushmark s ->1h
207# 1h <$> const(PV "warnings") sM ->1i
208# 1i <$> const(PV "qw") sM ->1j
209# 1j <.> method_named(PV "unimport") ->1k
210# BEGIN 7:
211# 1p <1> leavesub[1 ref] K/REFC,1 ->(end)
212# - <@> lineseq KP ->1p
213# 1m <;> nextstate(main 3 -e:1) v:{ ->1n
214# 1o <1> postinc[t2] sK/1 ->1p
215# - <1> ex-rv2sv sKRM/1 ->1o
216# 1n <$> gvsv(*beg) s ->1o
cc02ea56
JC
217EONT_EONT
218
cc02ea56
JC
219checkOptree ( name => 'END',
220 bcopts => 'END',
221 prog => $src,
be2b1c74 222 strip_open_hints => 1,
cc02ea56
JC
223 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
224# END 1:
225# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
226# - <@> lineseq KP ->4
c954b578 227# 1 <;> nextstate(main 5 -e:6) v:>,<,%,{ ->2
cc02ea56
JC
228# 3 <1> postinc[t3] sK/1 ->4
229# - <1> ex-rv2sv sKRM/1 ->3
230# 2 <#> gvsv[*end] s ->3
231EOT_EOT
232# END 1:
233# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
234# - <@> lineseq KP ->4
c954b578 235# 1 <;> nextstate(main 5 -e:6) v:>,<,%,{ ->2
cc02ea56
JC
236# 3 <1> postinc[t2] sK/1 ->4
237# - <1> ex-rv2sv sKRM/1 ->3
238# 2 <$> gvsv(*end) s ->3
239EONT_EONT
240
cc02ea56
JC
241checkOptree ( name => 'CHECK',
242 bcopts => 'CHECK',
243 prog => $src,
be2b1c74 244 strip_open_hints => 1,
cc02ea56
JC
245 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
246# CHECK 1:
247# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
248# - <@> lineseq KP ->4
c954b578 249# 1 <;> nextstate(main 3 -e:4) v:>,<,%,{ ->2
cc02ea56
JC
250# 3 <1> postinc[t3] sK/1 ->4
251# - <1> ex-rv2sv sKRM/1 ->3
252# 2 <#> gvsv[*chk] s ->3
253EOT_EOT
254# CHECK 1:
255# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
256# - <@> lineseq KP ->4
c954b578 257# 1 <;> nextstate(main 3 -e:4) v:>,<,%,{ ->2
cc02ea56
JC
258# 3 <1> postinc[t2] sK/1 ->4
259# - <1> ex-rv2sv sKRM/1 ->3
260# 2 <$> gvsv(*chk) s ->3
261EONT_EONT
262
35633035
DM
263checkOptree ( name => 'UNITCHECK',
264 bcopts=> 'UNITCHECK',
265 prog => $src,
266 strip_open_hints => 1,
267 expect=> <<'EOT_EOT', expect_nt => <<'EONT_EONT');
676456c2
AG
268# UNITCHECK 1:
269# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
270# - <@> lineseq KP ->4
c954b578 271# 1 <;> nextstate(main 3 -e:4) v:>,<,%,{ ->2
676456c2
AG
272# 3 <1> postinc[t3] sK/1 ->4
273# - <1> ex-rv2sv sKRM/1 ->3
274# 2 <#> gvsv[*uc] s ->3
275EOT_EOT
276# UNITCHECK 1:
277# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
278# - <@> lineseq KP ->4
c954b578 279# 1 <;> nextstate(main 3 -e:4) v:>,<,%,{ ->2
676456c2
AG
280# 3 <1> postinc[t2] sK/1 ->4
281# - <1> ex-rv2sv sKRM/1 ->3
282# 2 <$> gvsv(*uc) s ->3
283EONT_EONT
cc02ea56
JC
284
285checkOptree ( name => 'INIT',
286 bcopts => 'INIT',
287 #todo => 'get working',
288 prog => $src,
be2b1c74 289 strip_open_hints => 1,
cc02ea56
JC
290 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
291# INIT 1:
292# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
293# - <@> lineseq KP ->4
c954b578 294# 1 <;> nextstate(main 4 -e:5) v:>,<,%,{ ->2
cc02ea56
JC
295# 3 <1> postinc[t3] sK/1 ->4
296# - <1> ex-rv2sv sKRM/1 ->3
297# 2 <#> gvsv[*init] s ->3
298EOT_EOT
299# INIT 1:
300# 4 <1> leavesub[1 ref] K/REFC,1 ->(end)
301# - <@> lineseq KP ->4
c954b578 302# 1 <;> nextstate(main 4 -e:5) v:>,<,%,{ ->2
cc02ea56
JC
303# 3 <1> postinc[t2] sK/1 ->4
304# - <1> ex-rv2sv sKRM/1 ->3
305# 2 <$> gvsv(*init) s ->3
306EONT_EONT
307
676456c2
AG
308checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec',
309 bcopts => [qw/ BEGIN END INIT CHECK UNITCHECK -exec /],
cc02ea56 310 prog => $src,
be2b1c74 311 strip_open_hints => 1,
cc02ea56
JC
312 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
313# BEGIN 1:
95d444af
TR
314# 1 <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
315# 2 <#> gv[*STDOUT] s
316# 3 <1> rv2gv sKRM/STRICT,1
317# 4 <1> srefgen sK/1
318# 5 <#> gvsv[*B::Concise::walkHandle] s
319# 6 <2> sassign sKS/2
320# 7 <1> leavesub[1 ref] K/REFC,1
cc02ea56 321# BEGIN 2:
95d444af
TR
322# 8 <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
323# 9 <$> const[PV "strict.pm"] s/BARE
324# a <1> require sK/1
325# b <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
326# c <0> pushmark s
327# d <$> const[PV "strict"] sM
328# e <$> const[PV "refs"] sM
329# f <.> method_named[PV "unimport"]
330# g <1> entersub[t1] KRS*/TARG,STRICT
331# h <1> leavesub[1 ref] K/REFC,1
9e0f9750 332# BEGIN 3:
95d444af
TR
333# i <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
334# j <$> const[PV "strict.pm"] s/BARE
335# k <1> require sK/1
336# l <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
337# m <0> pushmark s
338# n <$> const[PV "strict"] sM
339# o <$> const[PV "refs"] sM
340# p <.> method_named[PV "unimport"]
341# q <1> entersub[t1] KRS*/TARG,STRICT
342# r <1> leavesub[1 ref] K/REFC,1
9e0f9750 343# BEGIN 4:
95d444af
TR
344# s <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
345# t <$> const[PV "strict.pm"] s/BARE
346# u <1> require sK/1
347# v <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
348# w <0> pushmark s
349# x <$> const[PV "strict"] sM
350# y <$> const[PV "refs"] sM
351# z <.> method_named[PV "unimport"]
352# 10 <1> entersub[t1] KRS*/TARG,STRICT
353# 11 <1> leavesub[1 ref] K/REFC,1
354# BEGIN 5:
355# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
356# 13 <$> const[PV "strict.pm"] s/BARE
357# 14 <1> require sK/1
358# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
359# 16 <0> pushmark s
360# 17 <$> const[PV "strict"] sM
361# 18 <$> const[PV "refs"] sM
362# 19 <.> method_named[PV "unimport"]
363# 1a <1> entersub[t1] KRS*/TARG,STRICT
364# 1b <1> leavesub[1 ref] K/REFC,1
365# BEGIN 6:
366# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
367# 1d <$> const[PV "warnings.pm"] s/BARE
368# 1e <1> require sK/1
369# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
370# 1g <0> pushmark s
371# 1h <$> const[PV "warnings"] sM
372# 1i <$> const[PV "qw"] sM
373# 1j <.> method_named[PV "unimport"]
374# 1k <1> entersub[t1] KRS*/TARG,STRICT
375# 1l <1> leavesub[1 ref] K/REFC,1
376# BEGIN 7:
377# 1m <;> nextstate(main 3 -e:1) v:{
378# 1n <#> gvsv[*beg] s
379# 1o <1> postinc[t3] sK/1
380# 1p <1> leavesub[1 ref] K/REFC,1
cc02ea56 381# END 1:
95d444af
TR
382# 1q <;> nextstate(main 9 -e:1) v:{
383# 1r <#> gvsv[*end] s
384# 1s <1> postinc[t3] sK/1
385# 1t <1> leavesub[1 ref] K/REFC,1
cc02ea56 386# INIT 1:
95d444af
TR
387# 1u <;> nextstate(main 7 -e:1) v:{
388# 1v <#> gvsv[*init] s
389# 1w <1> postinc[t3] sK/1
390# 1x <1> leavesub[1 ref] K/REFC,1
cc02ea56 391# CHECK 1:
95d444af
TR
392# 1y <;> nextstate(main 5 -e:1) v:{
393# 1z <#> gvsv[*chk] s
394# 20 <1> postinc[t3] sK/1
395# 21 <1> leavesub[1 ref] K/REFC,1
676456c2 396# UNITCHECK 1:
95d444af
TR
397# 22 <;> nextstate(main 11 -e:1) v:{
398# 23 <#> gvsv[*uc] s
399# 24 <1> postinc[t3] sK/1
400# 25 <1> leavesub[1 ref] K/REFC,1
cc02ea56
JC
401EOT_EOT
402# BEGIN 1:
95d444af
TR
403# 1 <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
404# 2 <$> gv(*STDOUT) s
405# 3 <1> rv2gv sKRM/STRICT,1
406# 4 <1> srefgen sK/1
407# 5 <$> gvsv(*B::Concise::walkHandle) s
408# 6 <2> sassign sKS/2
409# 7 <1> leavesub[1 ref] K/REFC,1
cc02ea56 410# BEGIN 2:
95d444af
TR
411# 8 <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
412# 9 <$> const(PV "strict.pm") s/BARE
413# a <1> require sK/1
414# b <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
415# c <0> pushmark s
416# d <$> const(PV "strict") sM
417# e <$> const(PV "refs") sM
418# f <.> method_named(PV "unimport")
419# g <1> entersub[t1] KRS*/TARG,STRICT
420# h <1> leavesub[1 ref] K/REFC,1
9e0f9750 421# BEGIN 3:
95d444af
TR
422# i <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
423# j <$> const(PV "strict.pm") s/BARE
424# k <1> require sK/1
425# l <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
426# m <0> pushmark s
427# n <$> const(PV "strict") sM
428# o <$> const(PV "refs") sM
429# p <.> method_named(PV "unimport")
430# q <1> entersub[t1] KRS*/TARG,STRICT
431# r <1> leavesub[1 ref] K/REFC,1
9e0f9750 432# BEGIN 4:
95d444af
TR
433# s <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
434# t <$> const(PV "strict.pm") s/BARE
435# u <1> require sK/1
436# v <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
437# w <0> pushmark s
438# x <$> const(PV "strict") sM
439# y <$> const(PV "refs") sM
440# z <.> method_named(PV "unimport")
441# 10 <1> entersub[t1] KRS*/TARG,STRICT
442# 11 <1> leavesub[1 ref] K/REFC,1
443# BEGIN 5:
444# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
445# 13 <$> const(PV "strict.pm") s/BARE
446# 14 <1> require sK/1
447# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
448# 16 <0> pushmark s
449# 17 <$> const(PV "strict") sM
450# 18 <$> const(PV "refs") sM
451# 19 <.> method_named(PV "unimport")
452# 1a <1> entersub[t1] KRS*/TARG,STRICT
453# 1b <1> leavesub[1 ref] K/REFC,1
454# BEGIN 6:
455# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
456# 1d <$> const(PV "warnings.pm") s/BARE
457# 1e <1> require sK/1
458# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
459# 1g <0> pushmark s
460# 1h <$> const(PV "warnings") sM
461# 1i <$> const(PV "qw") sM
462# 1j <.> method_named(PV "unimport")
463# 1k <1> entersub[t1] KRS*/TARG,STRICT
464# 1l <1> leavesub[1 ref] K/REFC,1
465# BEGIN 7:
466# 1m <;> nextstate(main 3 -e:1) v:{
467# 1n <$> gvsv(*beg) s
468# 1o <1> postinc[t2] sK/1
469# 1p <1> leavesub[1 ref] K/REFC,1
cc02ea56 470# END 1:
95d444af
TR
471# 1q <;> nextstate(main 9 -e:1) v:{
472# 1r <$> gvsv(*end) s
473# 1s <1> postinc[t2] sK/1
474# 1t <1> leavesub[1 ref] K/REFC,1
cc02ea56 475# INIT 1:
95d444af
TR
476# 1u <;> nextstate(main 7 -e:1) v:{
477# 1v <$> gvsv(*init) s
478# 1w <1> postinc[t2] sK/1
479# 1x <1> leavesub[1 ref] K/REFC,1
cc02ea56 480# CHECK 1:
95d444af
TR
481# 1y <;> nextstate(main 5 -e:1) v:{
482# 1z <$> gvsv(*chk) s
483# 20 <1> postinc[t2] sK/1
484# 21 <1> leavesub[1 ref] K/REFC,1
676456c2 485# UNITCHECK 1:
95d444af
TR
486# 22 <;> nextstate(main 11 -e:1) v:{
487# 23 <$> gvsv(*uc) s
488# 24 <1> postinc[t2] sK/1
489# 25 <1> leavesub[1 ref] K/REFC,1
cc02ea56 490EONT_EONT
2c394315 491
2c394315
JC
492# perl "-I../lib" -MO=Concise,BEGIN,CHECK,INIT,END,-exec -e '$a=$b && print q/foo/'
493
2c394315
JC
494checkOptree ( name => 'regression test for patch 25352',
495 bcopts => [qw/ BEGIN END INIT CHECK -exec /],
496 prog => 'print q/foo/',
2c394315
JC
497 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
498# BEGIN 1:
894ea76b 499# 1 <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
95d444af
TR
500# 2 <#> gv[*STDOUT] s
501# 3 <1> rv2gv sKRM/STRICT,1
502# 4 <1> srefgen sK/1
503# 5 <#> gvsv[*B::Concise::walkHandle] s
504# 6 <2> sassign sKS/2
505# 7 <1> leavesub[1 ref] K/REFC,1
9e0f9750 506# BEGIN 2:
95d444af
TR
507# 8 <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
508# 9 <$> const[PV "strict.pm"] s/BARE
509# a <1> require sK/1
510# b <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
511# c <0> pushmark s
512# d <$> const[PV "strict"] sM
513# e <$> const[PV "refs"] sM
514# f <.> method_named[PV "unimport"]
515# g <1> entersub[t1] KRS*/TARG,STRICT
516# h <1> leavesub[1 ref] K/REFC,1
9e0f9750 517# BEGIN 3:
95d444af
TR
518# i <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
519# j <$> const[PV "strict.pm"] s/BARE
520# k <1> require sK/1
521# l <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
522# m <0> pushmark s
523# n <$> const[PV "strict"] sM
524# o <$> const[PV "refs"] sM
525# p <.> method_named[PV "unimport"]
526# q <1> entersub[t1] KRS*/TARG,STRICT
527# r <1> leavesub[1 ref] K/REFC,1
528# BEGIN 4:
529# s <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
530# t <$> const[PV "strict.pm"] s/BARE
531# u <1> require sK/1
532# v <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
533# w <0> pushmark s
534# x <$> const[PV "strict"] sM
535# y <$> const[PV "refs"] sM
536# z <.> method_named[PV "unimport"]
537# 10 <1> entersub[t1] KRS*/TARG,STRICT
538# 11 <1> leavesub[1 ref] K/REFC,1
539# BEGIN 5:
540# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
541# 13 <$> const[PV "strict.pm"] s/BARE
542# 14 <1> require sK/1
543# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
544# 16 <0> pushmark s
545# 17 <$> const[PV "strict"] sM
546# 18 <$> const[PV "refs"] sM
547# 19 <.> method_named[PV "unimport"]
548# 1a <1> entersub[t1] KRS*/TARG,STRICT
549# 1b <1> leavesub[1 ref] K/REFC,1
550# BEGIN 6:
551# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
552# 1d <$> const[PV "warnings.pm"] s/BARE
553# 1e <1> require sK/1
554# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
555# 1g <0> pushmark s
556# 1h <$> const[PV "warnings"] sM
557# 1i <$> const[PV "qw"] sM
558# 1j <.> method_named[PV "unimport"]
559# 1k <1> entersub[t1] KRS*/TARG,STRICT
560# 1l <1> leavesub[1 ref] K/REFC,1
2c394315
JC
561EOT_EOT
562# BEGIN 1:
95d444af
TR
563# 1 <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
564# 2 <$> gv(*STDOUT) s
565# 3 <1> rv2gv sKRM/STRICT,1
566# 4 <1> srefgen sK/1
567# 5 <$> gvsv(*B::Concise::walkHandle) s
568# 6 <2> sassign sKS/2
569# 7 <1> leavesub[1 ref] K/REFC,1
9e0f9750 570# BEGIN 2:
95d444af
TR
571# 8 <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
572# 9 <$> const(PV "strict.pm") s/BARE
573# a <1> require sK/1
574# b <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
575# c <0> pushmark s
576# d <$> const(PV "strict") sM
577# e <$> const(PV "refs") sM
578# f <.> method_named(PV "unimport")
579# g <1> entersub[t1] KRS*/TARG,STRICT
580# h <1> leavesub[1 ref] K/REFC,1
9e0f9750 581# BEGIN 3:
95d444af
TR
582# i <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
583# j <$> const(PV "strict.pm") s/BARE
584# k <1> require sK/1
585# l <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
586# m <0> pushmark s
587# n <$> const(PV "strict") sM
588# o <$> const(PV "refs") sM
589# p <.> method_named(PV "unimport")
590# q <1> entersub[t1] KRS*/TARG,STRICT
591# r <1> leavesub[1 ref] K/REFC,1
592# BEGIN 4:
593# s <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
594# t <$> const(PV "strict.pm") s/BARE
595# u <1> require sK/1
596# v <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
597# w <0> pushmark s
598# x <$> const(PV "strict") sM
599# y <$> const(PV "refs") sM
600# z <.> method_named(PV "unimport")
601# 10 <1> entersub[t1] KRS*/TARG,STRICT
602# 11 <1> leavesub[1 ref] K/REFC,1
603# BEGIN 5:
604# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
605# 13 <$> const(PV "strict.pm") s/BARE
606# 14 <1> require sK/1
607# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
608# 16 <0> pushmark s
609# 17 <$> const(PV "strict") sM
610# 18 <$> const(PV "refs") sM
611# 19 <.> method_named(PV "unimport")
612# 1a <1> entersub[t1] KRS*/TARG,STRICT
613# 1b <1> leavesub[1 ref] K/REFC,1
614# BEGIN 6:
615# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
616# 1d <$> const(PV "warnings.pm") s/BARE
617# 1e <1> require sK/1
618# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
619# 1g <0> pushmark s
620# 1h <$> const(PV "warnings") sM
621# 1i <$> const(PV "qw") sM
622# 1j <.> method_named(PV "unimport")
623# 1k <1> entersub[t1] KRS*/TARG,STRICT
624# 1l <1> leavesub[1 ref] K/REFC,1
2c394315 625EONT_EONT