Commit | Line | Data |
---|---|---|
87a42246 MS |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
62a6bb71 | 4 | unshift @INC, 't'; |
9cd8f857 NC |
5 | require Config; |
6 | if (($Config::Config{'extensions'} !~ /\bB\b/) ){ | |
7 | print "1..0 # Skip -- Perl configured without B module\n"; | |
8 | exit 0; | |
9 | } | |
87a42246 MS |
10 | } |
11 | ||
87a42246 MS |
12 | use warnings; |
13 | use strict; | |
e9c69003 NC |
14 | BEGIN { |
15 | # BEGIN block is acutally a subroutine :-) | |
16 | return unless $] > 5.009; | |
17 | require feature; | |
18 | feature->import(':5.10'); | |
19 | } | |
e7afc405 | 20 | use Test::More tests => 93; |
1bb3cfc5 | 21 | use Config (); |
87a42246 MS |
22 | |
23 | use B::Deparse; | |
09d856fb CK |
24 | my $deparse = B::Deparse->new(); |
25 | ok($deparse); | |
87a42246 MS |
26 | |
27 | # Tell B::Deparse about our ambient pragmas | |
0ced6c29 RGS |
28 | { my ($hint_bits, $warning_bits, $hinthash); |
29 | BEGIN { ($hint_bits, $warning_bits, $hinthash) = ($^H, ${^WARNING_BITS}, \%^H); } | |
87a42246 MS |
30 | $deparse->ambient_pragmas ( |
31 | hint_bits => $hint_bits, | |
32 | warning_bits => $warning_bits, | |
0ced6c29 RGS |
33 | '$[' => 0 + $[, |
34 | '%^H' => $hinthash, | |
87a42246 MS |
35 | ); |
36 | } | |
37 | ||
ad46c0be RH |
38 | $/ = "\n####\n"; |
39 | while (<DATA>) { | |
40 | chomp; | |
e9c69003 NC |
41 | # This code is pinched from the t/lib/common.pl for TODO. |
42 | # It's not clear how to avoid duplication | |
b871937f NC |
43 | # Now tweaked a bit to do skip or todo |
44 | my %reason; | |
45 | foreach my $what (qw(skip todo)) { | |
46 | s/^#\s*\U$what\E\s*(.*)\n//m and $reason{$what} = $1; | |
47 | # If the SKIP reason starts ? then it's taken as a code snippet to | |
48 | # evaluate. This provides the flexibility to have conditional SKIPs | |
49 | if ($reason{$what} && $reason{$what} =~ s/^\?//) { | |
50 | my $temp = eval $reason{$what}; | |
51 | if ($@) { | |
52 | die "# In \U$what\E code reason:\n# $reason{$what}\n$@"; | |
53 | } | |
54 | $reason{$what} = $temp; | |
e9c69003 | 55 | } |
e9c69003 NC |
56 | } |
57 | ||
4a4b8592 | 58 | s/^\s*#\s*(.*)$//mg; |
ec59cdf2 | 59 | my ($num, $testname) = $1 =~ m/(\d+)\s*(.*)/; |
e9c69003 | 60 | |
b871937f | 61 | if ($reason{skip}) { |
e9c69003 | 62 | # Like this to avoid needing a label SKIP: |
b871937f | 63 | Test::More->builder->skip($reason{skip}); |
e9c69003 NC |
64 | next; |
65 | } | |
66 | ||
ad46c0be RH |
67 | my ($input, $expected); |
68 | if (/(.*)\n>>>>\n(.*)/s) { | |
69 | ($input, $expected) = ($1, $2); | |
70 | } | |
71 | else { | |
72 | ($input, $expected) = ($_, $_); | |
73 | } | |
87a42246 | 74 | |
ad46c0be | 75 | my $coderef = eval "sub {$input}"; |
87a42246 | 76 | |
ad46c0be | 77 | if ($@) { |
ec59cdf2 RGS |
78 | diag("$num deparsed: $@"); |
79 | ok(0, $testname); | |
ad46c0be RH |
80 | } |
81 | else { | |
82 | my $deparsed = $deparse->coderef2text( $coderef ); | |
31c6271a RD |
83 | my $regex = $expected; |
84 | $regex =~ s/(\S+)/\Q$1/g; | |
85 | $regex =~ s/\s+/\\s+/g; | |
86 | $regex = '^\{\s*' . $regex . '\s*\}$'; | |
b871937f | 87 | |
4a4b8592 | 88 | local $::TODO = $reason{todo}; |
ec59cdf2 | 89 | like($deparsed, qr/$regex/, $testname); |
87a42246 | 90 | } |
87a42246 MS |
91 | } |
92 | ||
87a42246 | 93 | use constant 'c', 'stuff'; |
09d856fb | 94 | is((eval "sub ".$deparse->coderef2text(\&c))->(), 'stuff'); |
87a42246 | 95 | |
09d856fb CK |
96 | my $a = 0; |
97 | is("{\n (-1) ** \$a;\n}", $deparse->coderef2text(sub{(-1) ** $a })); | |
87a42246 | 98 | |
d989cdac SM |
99 | use constant cr => ['hello']; |
100 | my $string = "sub " . $deparse->coderef2text(\&cr); | |
0707d6cc NC |
101 | my $val = (eval $string)->() or diag $string; |
102 | is(ref($val), 'ARRAY'); | |
103 | is($val->[0], 'hello'); | |
87a42246 | 104 | |
87a42246 | 105 | my $path = join " ", map { qq["-I$_"] } @INC; |
87a42246 | 106 | |
7cde0a5f | 107 | $a = `$^X $path "-MO=Deparse" -anlwi.bak -e 1 2>&1`; |
e69a2255 | 108 | $a =~ s/-e syntax OK\n//g; |
d2bc402e | 109 | $a =~ s/.*possible typo.*\n//; # Remove warning line |
87a42246 MS |
110 | $a =~ s{\\340\\242}{\\s} if (ord("\\") == 224); # EBCDIC, cp 1047 or 037 |
111 | $a =~ s{\\274\\242}{\\s} if (ord("\\") == 188); # $^O eq 'posix-bc' | |
112 | $b = <<'EOF'; | |
d2bc402e RGS |
113 | BEGIN { $^I = ".bak"; } |
114 | BEGIN { $^W = 1; } | |
115 | BEGIN { $/ = "\n"; $\ = "\n"; } | |
87a42246 MS |
116 | LINE: while (defined($_ = <ARGV>)) { |
117 | chomp $_; | |
f86ea535 | 118 | our(@F) = split(' ', $_, 0); |
87a42246 MS |
119 | '???'; |
120 | } | |
87a42246 | 121 | EOF |
09d856fb | 122 | is($a, $b); |
87a42246 | 123 | |
5b4ee549 NC |
124 | $a = `$^X $path "-MO=Deparse" -e "use constant PI => 4" 2>&1`; |
125 | $a =~ s/-e syntax OK\n//g; | |
126 | is($a, "use constant ('PI', 4);\n", | |
127 | "Proxy Constant Subroutines must not show up as (incorrect) prototypes"); | |
128 | ||
579a54dc | 129 | #Re: perlbug #35857, patch #24505 |
b3980c39 YO |
130 | #handle warnings::register-ed packages properly. |
131 | package B::Deparse::Wrapper; | |
132 | use strict; | |
133 | use warnings; | |
134 | use warnings::register; | |
135 | sub getcode { | |
579a54dc | 136 | my $deparser = B::Deparse->new(); |
b3980c39 YO |
137 | return $deparser->coderef2text(shift); |
138 | } | |
139 | ||
2990415a FR |
140 | package Moo; |
141 | use overload '0+' => sub { 42 }; | |
142 | ||
b3980c39 YO |
143 | package main; |
144 | use strict; | |
145 | use warnings; | |
71c4dbc3 | 146 | use constant GLIPP => 'glipp'; |
2990415a FR |
147 | use constant PI => 4; |
148 | use constant OVERLOADED_NUMIFICATION => bless({}, 'Moo'); | |
3779476a | 149 | use Fcntl qw/O_TRUNC O_APPEND O_EXCL/; |
aaf9c2b2 | 150 | BEGIN { delete $::Fcntl::{O_APPEND}; } |
2990415a | 151 | use POSIX qw/O_CREAT/; |
b3980c39 | 152 | sub test { |
579a54dc RGS |
153 | my $val = shift; |
154 | my $res = B::Deparse::Wrapper::getcode($val); | |
09d856fb | 155 | like( $res, qr/use warnings/); |
b3980c39 YO |
156 | } |
157 | my ($q,$p); | |
158 | my $x=sub { ++$q,++$p }; | |
159 | test($x); | |
160 | eval <<EOFCODE and test($x); | |
161 | package bar; | |
162 | use strict; | |
163 | use warnings; | |
164 | use warnings::register; | |
165 | package main; | |
166 | 1 | |
167 | EOFCODE | |
168 | ||
640d5d41 FC |
169 | # [perl #33752] |
170 | { | |
171 | my $code = <<"EOCODE"; | |
172 | { | |
173 | our \$\x{1e1f}\x{14d}\x{14d}; | |
174 | } | |
175 | EOCODE | |
176 | my $deparsed | |
177 | = $deparse->coderef2text(eval "sub { our \$\x{1e1f}\x{14d}\x{14d} }" ); | |
178 | s/$ \n//x for $deparsed, $code; | |
179 | is $deparsed, $code, 'our $funny_Unicode_chars'; | |
180 | } | |
181 | ||
ad46c0be | 182 | __DATA__ |
14a55f98 | 183 | # 2 |
ad46c0be RH |
184 | 1; |
185 | #### | |
14a55f98 | 186 | # 3 |
ad46c0be RH |
187 | { |
188 | no warnings; | |
189 | '???'; | |
190 | 2; | |
191 | } | |
192 | #### | |
14a55f98 | 193 | # 4 |
ad46c0be RH |
194 | my $test; |
195 | ++$test and $test /= 2; | |
196 | >>>> | |
197 | my $test; | |
198 | $test /= 2 if ++$test; | |
199 | #### | |
14a55f98 | 200 | # 5 |
ad46c0be RH |
201 | -((1, 2) x 2); |
202 | #### | |
14a55f98 | 203 | # 6 |
ad46c0be RH |
204 | { |
205 | my $test = sub : lvalue { | |
206 | my $x; | |
207 | } | |
208 | ; | |
209 | } | |
210 | #### | |
14a55f98 | 211 | # 7 |
ad46c0be RH |
212 | { |
213 | my $test = sub : method { | |
214 | my $x; | |
215 | } | |
216 | ; | |
217 | } | |
218 | #### | |
14a55f98 | 219 | # 8 |
8e5dadda NC |
220 | # Was sub : locked method { ... } |
221 | # This number could be re-used. | |
ad46c0be | 222 | #### |
14a55f98 | 223 | # 9 |
87a42246 | 224 | { |
ad46c0be | 225 | 234; |
f99a63a2 | 226 | } |
ad46c0be RH |
227 | continue { |
228 | 123; | |
87a42246 | 229 | } |
ce4e655d | 230 | #### |
14a55f98 | 231 | # 10 |
ce4e655d RH |
232 | my $x; |
233 | print $main::x; | |
234 | #### | |
14a55f98 | 235 | # 11 |
ce4e655d RH |
236 | my @x; |
237 | print $main::x[1]; | |
14a55f98 RH |
238 | #### |
239 | # 12 | |
240 | my %x; | |
241 | $x{warn()}; | |
ad8caead RGS |
242 | #### |
243 | # 13 | |
244 | my $foo; | |
245 | $_ .= <ARGV> . <$foo>; | |
cef22867 JH |
246 | #### |
247 | # 14 | |
248 | my $foo = "Ab\x{100}\200\x{200}\377Cd\000Ef\x{1000}\cA\x{2000}\cZ"; | |
4ae52e81 RGS |
249 | #### |
250 | # 15 | |
251 | s/x/'y';/e; | |
241416b8 DM |
252 | #### |
253 | # 16 - various lypes of loop | |
254 | { my $x; } | |
255 | #### | |
256 | # 17 | |
257 | while (1) { my $k; } | |
258 | #### | |
259 | # 18 | |
260 | my ($x,@a); | |
261 | $x=1 for @a; | |
262 | >>>> | |
263 | my($x, @a); | |
0bb5f065 | 264 | $x = 1 foreach (@a); |
241416b8 DM |
265 | #### |
266 | # 19 | |
267 | for (my $i = 0; $i < 2;) { | |
268 | my $z = 1; | |
269 | } | |
270 | #### | |
271 | # 20 | |
272 | for (my $i = 0; $i < 2; ++$i) { | |
273 | my $z = 1; | |
274 | } | |
275 | #### | |
276 | # 21 | |
277 | for (my $i = 0; $i < 2; ++$i) { | |
278 | my $z = 1; | |
279 | } | |
280 | #### | |
281 | # 22 | |
282 | my $i; | |
283 | while ($i) { my $z = 1; } continue { $i = 99; } | |
284 | #### | |
285 | # 23 | |
09d856fb | 286 | foreach my $i (1, 2) { |
241416b8 DM |
287 | my $z = 1; |
288 | } | |
289 | #### | |
290 | # 24 | |
291 | my $i; | |
292 | foreach $i (1, 2) { | |
293 | my $z = 1; | |
294 | } | |
295 | #### | |
296 | # 25 | |
297 | my $i; | |
298 | foreach my $i (1, 2) { | |
299 | my $z = 1; | |
300 | } | |
301 | #### | |
302 | # 26 | |
303 | foreach my $i (1, 2) { | |
304 | my $z = 1; | |
305 | } | |
306 | #### | |
307 | # 27 | |
308 | foreach our $i (1, 2) { | |
309 | my $z = 1; | |
310 | } | |
311 | #### | |
312 | # 28 | |
313 | my $i; | |
314 | foreach our $i (1, 2) { | |
315 | my $z = 1; | |
316 | } | |
3ac6e0f9 RGS |
317 | #### |
318 | # 29 | |
319 | my @x; | |
320 | print reverse sort(@x); | |
321 | #### | |
322 | # 30 | |
323 | my @x; | |
324 | print((sort {$b cmp $a} @x)); | |
325 | #### | |
326 | # 31 | |
327 | my @x; | |
328 | print((reverse sort {$b <=> $a} @x)); | |
36d57d93 RGS |
329 | #### |
330 | # 32 | |
331 | our @a; | |
332 | print $_ foreach (reverse @a); | |
aae53c41 | 333 | #### |
579a54dc | 334 | # 33 |
aae53c41 RGS |
335 | our @a; |
336 | print $_ foreach (reverse 1, 2..5); | |
f86ea535 SM |
337 | #### |
338 | # 34 (bug #38684) | |
339 | our @ary; | |
340 | @ary = split(' ', 'foo', 0); | |
31c6271a RD |
341 | #### |
342 | # 35 (bug #40055) | |
343 | do { () }; | |
344 | #### | |
345 | # 36 (ibid.) | |
346 | do { my $x = 1; $x }; | |
d9002312 SM |
347 | #### |
348 | # 37 <20061012113037.GJ25805@c4.convolution.nl> | |
349 | my $f = sub { | |
350 | +{[]}; | |
351 | } ; | |
8b2d6640 FC |
352 | #### |
353 | # 38 (bug #43010) | |
354 | '!@$%'->(); | |
355 | #### | |
356 | # 39 (ibid.) | |
357 | ::(); | |
358 | #### | |
359 | # 40 (ibid.) | |
360 | '::::'->(); | |
361 | #### | |
362 | # 41 (ibid.) | |
363 | &::::; | |
09d856fb CK |
364 | #### |
365 | # 42 | |
366 | my $bar; | |
367 | 'Foo'->$bar('orz'); | |
368 | #### | |
369 | # 43 | |
370 | 'Foo'->bar('orz'); | |
371 | #### | |
372 | # 44 | |
373 | 'Foo'->bar; | |
0ced6c29 | 374 | #### |
e9c69003 | 375 | # SKIP ?$] < 5.010 && "say not implemented on this Perl version" |
7ddd1a01 NC |
376 | # 45 say |
377 | say 'foo'; | |
378 | #### | |
e9c69003 | 379 | # SKIP ?$] < 5.010 && "state vars not implemented on this Perl version" |
7ddd1a01 | 380 | # 46 state vars |
0ced6c29 RGS |
381 | state $x = 42; |
382 | #### | |
e9c69003 | 383 | # SKIP ?$] < 5.010 && "state vars not implemented on this Perl version" |
7ddd1a01 NC |
384 | # 47 state var assignment |
385 | { | |
386 | my $y = (state $x = 42); | |
387 | } | |
388 | #### | |
e9c69003 | 389 | # SKIP ?$] < 5.010 && "state vars not implemented on this Perl version" |
7ddd1a01 NC |
390 | # 48 state vars in anoymous subroutines |
391 | $a = sub { | |
392 | state $x; | |
393 | return $x++; | |
394 | } | |
395 | ; | |
644741fd NC |
396 | #### |
397 | # SKIP ?$] < 5.011 && 'each @array not implemented on this Perl version' | |
398 | # 49 each @array; | |
399 | each @ARGV; | |
400 | each @$a; | |
401 | #### | |
402 | # SKIP ?$] < 5.011 && 'each @array not implemented on this Perl version' | |
403 | # 50 keys @array; values @array | |
404 | keys @$a if keys @ARGV; | |
405 | values @ARGV if values @$a; | |
35925e80 | 406 | #### |
43b09ad7 | 407 | # 51 Anonymous arrays and hashes, and references to them |
35925e80 RGS |
408 | my $a = {}; |
409 | my $b = \{}; | |
410 | my $c = []; | |
411 | my $d = \[]; | |
9210de83 FR |
412 | #### |
413 | # SKIP ?$] < 5.010 && "smartmatch and given/when not implemented on this Perl version" | |
43b09ad7 | 414 | # 52 implicit smartmatch in given/when |
9210de83 FR |
415 | given ('foo') { |
416 | when ('bar') { continue; } | |
417 | when ($_ ~~ 'quux') { continue; } | |
418 | default { 0; } | |
419 | } | |
7ecdd211 PJ |
420 | #### |
421 | # 53 conditions in elsifs (regression in change #33710 which fixed bug #37302) | |
422 | if ($a) { x(); } | |
423 | elsif ($b) { x(); } | |
424 | elsif ($a and $b) { x(); } | |
425 | elsif ($a or $b) { x(); } | |
426 | else { x(); } | |
03b22f1b RGS |
427 | #### |
428 | # 54 interpolation in regexps | |
429 | my($y, $t); | |
430 | /x${y}z$t/; | |
227375e1 | 431 | #### |
4a4b8592 | 432 | # TODO new undocumented cpan-bug #33708 |
227375e1 RU |
433 | # 55 (cpan-bug #33708) |
434 | %{$_ || {}} | |
435 | #### | |
4a4b8592 | 436 | # TODO hash constants not yet fixed |
227375e1 RU |
437 | # 56 (cpan-bug #33708) |
438 | use constant H => { "#" => 1 }; H->{"#"} | |
439 | #### | |
4a4b8592 | 440 | # TODO optimized away 0 not yet fixed |
227375e1 RU |
441 | # 57 (cpan-bug #33708) |
442 | foreach my $i (@_) { 0 } | |
edbe35ea VP |
443 | #### |
444 | # 58 tests with not, not optimized | |
07f3cdf5 | 445 | my $c; |
edbe35ea VP |
446 | x() unless $a; |
447 | x() if not $a and $b; | |
448 | x() if $a and not $b; | |
449 | x() unless not $a and $b; | |
450 | x() unless $a and not $b; | |
451 | x() if not $a or $b; | |
452 | x() if $a or not $b; | |
453 | x() unless not $a or $b; | |
454 | x() unless $a or not $b; | |
07f3cdf5 VP |
455 | x() if $a and not $b and $c; |
456 | x() if not $a and $b and not $c; | |
457 | x() unless $a and not $b and $c; | |
458 | x() unless not $a and $b and not $c; | |
459 | x() if $a or not $b or $c; | |
460 | x() if not $a or $b or not $c; | |
461 | x() unless $a or not $b or $c; | |
462 | x() unless not $a or $b or not $c; | |
edbe35ea VP |
463 | #### |
464 | # 59 tests with not, optimized | |
07f3cdf5 | 465 | my $c; |
edbe35ea VP |
466 | x() if not $a; |
467 | x() unless not $a; | |
468 | x() if not $a and not $b; | |
469 | x() unless not $a and not $b; | |
470 | x() if not $a or not $b; | |
471 | x() unless not $a or not $b; | |
07f3cdf5 VP |
472 | x() if not $a and not $b and $c; |
473 | x() unless not $a and not $b and $c; | |
474 | x() if not $a or not $b or $c; | |
475 | x() unless not $a or not $b or $c; | |
476 | x() if not $a and not $b and not $c; | |
477 | x() unless not $a and not $b and not $c; | |
478 | x() if not $a or not $b or not $c; | |
479 | x() unless not $a or not $b or not $c; | |
480 | x() unless not $a or not $b or not $c; | |
edbe35ea | 481 | >>>> |
07f3cdf5 | 482 | my $c; |
edbe35ea VP |
483 | x() unless $a; |
484 | x() if $a; | |
485 | x() unless $a or $b; | |
486 | x() if $a or $b; | |
487 | x() unless $a and $b; | |
07f3cdf5 VP |
488 | x() if $a and $b; |
489 | x() if not $a || $b and $c; | |
490 | x() unless not $a || $b and $c; | |
491 | x() if not $a && $b or $c; | |
492 | x() unless not $a && $b or $c; | |
493 | x() unless $a or $b or $c; | |
494 | x() if $a or $b or $c; | |
495 | x() unless $a and $b and $c; | |
496 | x() if $a and $b and $c; | |
497 | x() unless not $a && $b && $c; | |
71c4dbc3 VP |
498 | #### |
499 | # 60 tests that should be constant folded | |
500 | x() if 1; | |
501 | x() if GLIPP; | |
502 | x() if !GLIPP; | |
503 | x() if GLIPP && GLIPP; | |
504 | x() if !GLIPP || GLIPP; | |
505 | x() if do { GLIPP }; | |
506 | x() if do { no warnings 'void'; 5; GLIPP }; | |
507 | x() if do { !GLIPP }; | |
508 | if (GLIPP) { x() } else { z() } | |
509 | if (!GLIPP) { x() } else { z() } | |
510 | if (GLIPP) { x() } elsif (GLIPP) { z() } | |
511 | if (!GLIPP) { x() } elsif (GLIPP) { z() } | |
512 | if (GLIPP) { x() } elsif (!GLIPP) { z() } | |
513 | if (!GLIPP) { x() } elsif (!GLIPP) { z() } | |
514 | if (!GLIPP) { x() } elsif (!GLIPP) { z() } elsif (GLIPP) { t() } | |
515 | if (!GLIPP) { x() } elsif (!GLIPP) { z() } elsif (!GLIPP) { t() } | |
516 | if (!GLIPP) { x() } elsif (!GLIPP) { z() } elsif (!GLIPP) { t() } | |
517 | >>>> | |
518 | x(); | |
519 | x(); | |
520 | '???'; | |
521 | x(); | |
522 | x(); | |
523 | x(); | |
524 | x(); | |
525 | do { | |
526 | '???' | |
527 | }; | |
528 | do { | |
529 | x() | |
530 | }; | |
531 | do { | |
532 | z() | |
533 | }; | |
534 | do { | |
535 | x() | |
536 | }; | |
537 | do { | |
538 | z() | |
539 | }; | |
540 | do { | |
541 | x() | |
542 | }; | |
543 | '???'; | |
544 | do { | |
545 | t() | |
546 | }; | |
547 | '???'; | |
548 | !1; | |
549 | #### | |
719c50dc RGS |
550 | # TODO constant deparsing has been backed out for 5.12 |
551 | # XXXTODO ? $Config::Config{useithreads} && "doesn't work with threads" | |
71c4dbc3 | 552 | # 61 tests that shouldn't be constant folded |
ac0f1413 NC |
553 | # It might be fundamentally impossible to make this work on ithreads, in which |
554 | # case the TODO should become a SKIP | |
71c4dbc3 VP |
555 | x() if $a; |
556 | if ($a == 1) { x() } elsif ($b == 2) { z() } | |
557 | if (do { foo(); GLIPP }) { x() } | |
558 | if (do { $a++; GLIPP }) { x() } | |
559 | >>>> | |
560 | x() if $a; | |
561 | if ($a == 1) { x(); } elsif ($b == 2) { z(); } | |
2990415a FR |
562 | if (do { foo(); GLIPP }) { x(); } |
563 | if (do { ++$a; GLIPP }) { x(); } | |
564 | #### | |
0fa4a265 | 565 | # TODO constant deparsing has been backed out for 5.12 |
2990415a FR |
566 | # 62 tests for deparsing constants |
567 | warn PI; | |
568 | #### | |
0fa4a265 | 569 | # TODO constant deparsing has been backed out for 5.12 |
2990415a | 570 | # 63 tests for deparsing imported constants |
3779476a | 571 | warn O_TRUNC; |
2990415a | 572 | #### |
0fa4a265 | 573 | # TODO constant deparsing has been backed out for 5.12 |
2990415a FR |
574 | # 64 tests for deparsing re-exported constants |
575 | warn O_CREAT; | |
576 | #### | |
0fa4a265 | 577 | # TODO constant deparsing has been backed out for 5.12 |
2990415a | 578 | # 65 tests for deparsing imported constants that got deleted from the original namespace |
aaf9c2b2 | 579 | warn O_APPEND; |
2990415a | 580 | #### |
0fa4a265 DM |
581 | # TODO constant deparsing has been backed out for 5.12 |
582 | # XXXTODO ? $Config::Config{useithreads} && "doesn't work with threads" | |
2990415a | 583 | # 66 tests for deparsing constants which got turned into full typeglobs |
ac0f1413 NC |
584 | # It might be fundamentally impossible to make this work on ithreads, in which |
585 | # case the TODO should become a SKIP | |
2990415a FR |
586 | warn O_EXCL; |
587 | eval '@Fcntl::O_EXCL = qw/affe tiger/;'; | |
588 | warn O_EXCL; | |
589 | #### | |
0fa4a265 | 590 | # TODO constant deparsing has been backed out for 5.12 |
2990415a FR |
591 | # 67 tests for deparsing of blessed constant with overloaded numification |
592 | warn OVERLOADED_NUMIFICATION; | |
79289e05 NC |
593 | #### |
594 | # TODO Only strict 'refs' currently supported | |
595 | # 68 strict | |
596 | no strict; | |
597 | $x; | |
598 | #### | |
599 | # TODO Subsets of warnings could be encoded textually, rather than as bitflips. | |
600 | no warnings 'deprecated'; | |
601 | my $x; | |
602 | #### | |
603 | # TODO Better test for CPAN #33708 - the deparsed code has different behaviour | |
604 | use strict; | |
605 | no warnings; | |
606 | ||
607 | foreach (0..3) { | |
608 | my $x = 2; | |
609 | { | |
610 | my $x if 0; | |
611 | print ++$x, "\n"; | |
612 | } | |
613 | } | |
d83f38d8 NC |
614 | #### |
615 | my $pi = 4; | |
616 | #### | |
617 | no warnings; | |
618 | my $pi := 4; | |
619 | >>>> | |
620 | no warnings; | |
621 | my $pi = 4; | |
622 | #### | |
623 | my $pi : = 4; | |
624 | >>>> | |
625 | my $pi = 4; | |
689e417f VP |
626 | #### |
627 | our @a; | |
628 | my @b; | |
629 | @a = sort @a; | |
630 | @b = sort @b; | |
631 | (); | |
632 | #### | |
633 | our @a; | |
634 | my @b; | |
635 | @a = reverse @a; | |
636 | @b = reverse @b; | |
637 | (); | |
06fc6867 VP |
638 | #### |
639 | my($r, $s, @a); | |
640 | @a = split(/foo/, $s, 0); | |
641 | $r = qr/foo/; | |
642 | @a = split(/$r/, $s, 0); | |
643 | (); | |
98a1a137 Z |
644 | #### |
645 | { | |
646 | package Foo; | |
647 | label: print 123; | |
648 | } | |
538f5756 RZ |
649 | #### |
650 | shift; | |
651 | >>>> | |
652 | shift(); | |
653 | #### | |
654 | shift @_; | |
655 | #### | |
656 | pop; | |
657 | >>>> | |
658 | pop(); | |
659 | #### | |
660 | pop @_; | |
a539498a FC |
661 | #### |
662 | # 82 [perl #20444] | |
663 | "foo" =~ (1 ? /foo/ : /bar/); | |
664 | "foo" =~ (1 ? y/foo// : /bar/); | |
665 | "foo" =~ (1 ? s/foo// : /bar/); | |
666 | >>>> | |
667 | 'foo' =~ ($_ =~ /foo/); | |
668 | 'foo' =~ ($_ =~ tr/fo//); | |
669 | 'foo' =~ ($_ =~ s/foo//); | |
e0ab66ad NC |
670 | #### |
671 | # Test @threadsv_names under 5005threads | |
672 | foreach $' (1, 2) { | |
673 | sleep $'; | |
674 | } | |
e7afc405 FC |
675 | #### |
676 | # y///r | |
677 | tr/a/b/r; |