Make Config.t warnings and strictures clean
[p5sagit/p5-mst-13.2.git] / ext / B / t / optree_specials.t
CommitLineData
cc02ea56 1#!./perl
2
3BEGIN {
4 chdir 't';
5 @INC = ('../lib', '../ext/B/t');
9cd8f857 6 require Config;
7 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
8 print "1..0 # Skip -- Perl configured without B module\n";
9 exit 0;
10 }
8dd2f9d4 11 if ($Config::Config{'extensions'} !~ /\bData\/Dumper\b/) {
2799c206 12 print
13 "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n";
14 exit 0;
2799c206 15 }
cc02ea56 16 require './test.pl';
17}
18
19# import checkOptree(), and %gOpts (containing test state)
20use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!!
21use Config;
22
23plan tests => 6;
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
bc2a472e 34my $src = q[our ($beg, $chk, $init, $end) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ }];
cc02ea56 35
36
37
38checkOptree ( name => 'BEGIN',
39 bcopts => 'BEGIN',
40 prog => $src,
41 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
42# BEGIN 1:
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
49# - <@> lineseq K ->-
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
56# BEGIN 2:
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
63# - <@> lineseq K ->-
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
70# BEGIN 3:
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
77EOT_EOT
78# BEGIN 1:
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
85# - <@> lineseq K ->-
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
92# BEGIN 2:
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
99# - <@> lineseq K ->-
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
106# BEGIN 3:
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
113EONT_EONT
114
115
116checkOptree ( name => 'END',
117 bcopts => 'END',
118 prog => $src,
119 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
120# END 1:
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
127EOT_EOT
128# END 1:
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
135EONT_EONT
136
137
138checkOptree ( name => 'CHECK',
139 bcopts => 'CHECK',
140 prog => $src,
141 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
142# CHECK 1:
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
149EOT_EOT
150# CHECK 1:
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
157EONT_EONT
158
159
160checkOptree ( name => 'INIT',
161 bcopts => 'INIT',
162 #todo => 'get working',
163 prog => $src,
164 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
165# INIT 1:
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
172EOT_EOT
173# INIT 1:
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
180EONT_EONT
181
182
183checkOptree ( name => 'all of BEGIN END INIT CHECK -exec',
184 bcopts => [qw/ BEGIN END INIT CHECK -exec /],
185 #todo => 'get working',
186 prog => $src,
187 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
188# BEGIN 1:
189# 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
190# 2 <$> const[PV "strict.pm"] s/BARE
191# 3 <1> require sK/1
192# 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
193# 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
194# 6 <0> pushmark s
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
200# BEGIN 2:
201# c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
202# d <$> const[PV "warnings.pm"] s/BARE
203# e <1> require sK/1
204# f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
205# g <;> nextstate(B::Concise -227 Concise.pm:327) /2
206# h <0> pushmark s
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
212# BEGIN 3:
213# n <;> nextstate(main 2 -e:3) v
214# o <#> gvsv[*beg] s
215# p <1> postinc[t3] sK/1
216# q <1> leavesub[1 ref] K/REFC,1
217# END 1:
218# r <;> nextstate(main 5 -e:6) v
219# s <#> gvsv[*end] s
220# t <1> postinc[t3] sK/1
221# u <1> leavesub[1 ref] K/REFC,1
222# INIT 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
227# CHECK 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
232EOT_EOT
233# BEGIN 1:
234# 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
235# 2 <$> const(PV "strict.pm") s/BARE
236# 3 <1> require sK/1
237# 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
238# 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
239# 6 <0> pushmark s
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
245# BEGIN 2:
246# c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
247# d <$> const(PV "warnings.pm") s/BARE
248# e <1> require sK/1
249# f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
250# g <;> nextstate(B::Concise -227 Concise.pm:327) /2
251# h <0> pushmark s
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
257# BEGIN 3:
258# n <;> nextstate(main 2 -e:3) v
259# o <$> gvsv(*beg) s
260# p <1> postinc[t2] sK/1
261# q <1> leavesub[1 ref] K/REFC,1
262# END 1:
263# r <;> nextstate(main 5 -e:6) v
264# s <$> gvsv(*end) s
265# t <1> postinc[t2] sK/1
266# u <1> leavesub[1 ref] K/REFC,1
267# INIT 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
272# CHECK 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
277EONT_EONT