This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Squelch warning in deparse.t
[perl5.git] / dist / B-Deparse / t / deparse.t
CommitLineData
87a42246
MS
1#!./perl
2
3BEGIN {
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
12use warnings;
13use strict;
e9c69003 14BEGIN {
c4a6f826 15 # BEGIN block is actually a subroutine :-)
e9c69003
NC
16 return unless $] > 5.009;
17 require feature;
18 feature->import(':5.10');
19}
507a68aa 20use Test::More;
1bb3cfc5 21use Config ();
87a42246
MS
22
23use B::Deparse;
09d856fb 24my $deparse = B::Deparse->new();
507a68aa 25isa_ok($deparse, 'B::Deparse', 'instantiate a B::Deparse object');
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";
39while (<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;
507a68aa
NC
59 my $desc = $1;
60 die "Missing name in test $_" unless defined $desc;
e9c69003 61
b871937f 62 if ($reason{skip}) {
e9c69003 63 # Like this to avoid needing a label SKIP:
b871937f 64 Test::More->builder->skip($reason{skip});
e9c69003
NC
65 next;
66 }
67
ad46c0be
RH
68 my ($input, $expected);
69 if (/(.*)\n>>>>\n(.*)/s) {
70 ($input, $expected) = ($1, $2);
71 }
72 else {
73 ($input, $expected) = ($_, $_);
74 }
87a42246 75
ad46c0be 76 my $coderef = eval "sub {$input}";
87a42246 77
ad46c0be 78 if ($@) {
507a68aa 79 is($@, "", "compilation of $desc");
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};
507a68aa 89 like($deparsed, qr/$regex/, $desc);
87a42246 90 }
87a42246
MS
91}
92
87a42246 93use constant 'c', 'stuff';
507a68aa
NC
94is((eval "sub ".$deparse->coderef2text(\&c))->(), 'stuff',
95 'the subroutine generated by use constant deparses');
87a42246 96
09d856fb 97my $a = 0;
507a68aa
NC
98is($deparse->coderef2text(sub{(-1) ** $a }), "{\n (-1) ** \$a;\n}",
99 'anon sub capturing an external lexical');
87a42246 100
d989cdac
SM
101use constant cr => ['hello'];
102my $string = "sub " . $deparse->coderef2text(\&cr);
0707d6cc 103my $val = (eval $string)->() or diag $string;
507a68aa
NC
104is(ref($val), 'ARRAY', 'constant array references deparse');
105is($val->[0], 'hello', 'and return the correct value');
87a42246 106
87a42246 107my $path = join " ", map { qq["-I$_"] } @INC;
87a42246 108
7cde0a5f 109$a = `$^X $path "-MO=Deparse" -anlwi.bak -e 1 2>&1`;
e69a2255 110$a =~ s/-e syntax OK\n//g;
d2bc402e 111$a =~ s/.*possible typo.*\n//; # Remove warning line
87a42246
MS
112$a =~ s{\\340\\242}{\\s} if (ord("\\") == 224); # EBCDIC, cp 1047 or 037
113$a =~ s{\\274\\242}{\\s} if (ord("\\") == 188); # $^O eq 'posix-bc'
114$b = <<'EOF';
d2bc402e
RGS
115BEGIN { $^I = ".bak"; }
116BEGIN { $^W = 1; }
117BEGIN { $/ = "\n"; $\ = "\n"; }
87a42246
MS
118LINE: while (defined($_ = <ARGV>)) {
119 chomp $_;
f86ea535 120 our(@F) = split(' ', $_, 0);
87a42246
MS
121 '???';
122}
87a42246 123EOF
507a68aa
NC
124is($a, $b,
125 'command line flags deparse as BEGIN blocks setting control variables');
87a42246 126
5b4ee549
NC
127$a = `$^X $path "-MO=Deparse" -e "use constant PI => 4" 2>&1`;
128$a =~ s/-e syntax OK\n//g;
129is($a, "use constant ('PI', 4);\n",
130 "Proxy Constant Subroutines must not show up as (incorrect) prototypes");
131
579a54dc 132#Re: perlbug #35857, patch #24505
b3980c39
YO
133#handle warnings::register-ed packages properly.
134package B::Deparse::Wrapper;
135use strict;
136use warnings;
137use warnings::register;
138sub getcode {
579a54dc 139 my $deparser = B::Deparse->new();
b3980c39
YO
140 return $deparser->coderef2text(shift);
141}
142
2990415a
FR
143package Moo;
144use overload '0+' => sub { 42 };
145
b3980c39
YO
146package main;
147use strict;
148use warnings;
71c4dbc3 149use constant GLIPP => 'glipp';
2990415a
FR
150use constant PI => 4;
151use constant OVERLOADED_NUMIFICATION => bless({}, 'Moo');
3779476a 152use Fcntl qw/O_TRUNC O_APPEND O_EXCL/;
aaf9c2b2 153BEGIN { delete $::Fcntl::{O_APPEND}; }
2990415a 154use POSIX qw/O_CREAT/;
b3980c39 155sub test {
579a54dc
RGS
156 my $val = shift;
157 my $res = B::Deparse::Wrapper::getcode($val);
507a68aa
NC
158 like($res, qr/use warnings/,
159 '[perl #35857] [PATCH] B::Deparse doesnt handle warnings register properly');
b3980c39
YO
160}
161my ($q,$p);
162my $x=sub { ++$q,++$p };
163test($x);
164eval <<EOFCODE and test($x);
165 package bar;
166 use strict;
167 use warnings;
168 use warnings::register;
169 package main;
170 1
171EOFCODE
172
d1dc589d
FC
173# Exotic sub declarations
174$a = `$^X $path "-MO=Deparse" -e "sub ::::{}sub ::::::{}" 2>&1`;
175$a =~ s/-e syntax OK\n//g;
176is($a, <<'EOCODG', "sub :::: and sub ::::::");
177sub :::: {
178
179}
180sub :::::: {
181
182}
183EOCODG
184
640d5d41
FC
185# [perl #33752]
186{
187 my $code = <<"EOCODE";
188{
189 our \$\x{1e1f}\x{14d}\x{14d};
190}
191EOCODE
192 my $deparsed
193 = $deparse->coderef2text(eval "sub { our \$\x{1e1f}\x{14d}\x{14d} }" );
194 s/$ \n//x for $deparsed, $code;
195 is $deparsed, $code, 'our $funny_Unicode_chars';
196}
197
bdabb2d5
FC
198# [perl #62500]
199$a =
200 `$^X $path "-MO=Deparse" -e "BEGIN{*CORE::GLOBAL::require=sub{1}}" 2>&1`;
201$a =~ s/-e syntax OK\n//g;
202is($a, <<'EOCODF', "CORE::GLOBAL::require override causing panick");
203sub BEGIN {
204 *CORE::GLOBAL::require = sub {
205 1;
206 }
207 ;
208}
209EOCODF
210
bb8996b8 211# [perl #93990]
5c19ffe6 212@* = ();
bb8996b8
HY
213is($deparse->coderef2text(sub{ print "@{*}" }),
214q<{
215 print "@{*}";
216}>, 'curly around to interpolate "@{*}"');
217is($deparse->coderef2text(sub{ print "@{-}" }),
218q<{
219 print "@-";
220}>, 'no need to curly around to interpolate "@-"');
221
507a68aa
NC
222done_testing();
223
ad46c0be 224__DATA__
507a68aa 225# A constant
ad46c0be
RH
2261;
227####
507a68aa 228# Constants in a block
ad46c0be
RH
229{
230 no warnings;
231 '???';
232 2;
233}
234####
507a68aa 235# Lexical and simple arithmetic
ad46c0be
RH
236my $test;
237++$test and $test /= 2;
238>>>>
239my $test;
240$test /= 2 if ++$test;
241####
507a68aa 242# list x
ad46c0be
RH
243-((1, 2) x 2);
244####
507a68aa 245# lvalue sub
ad46c0be
RH
246{
247 my $test = sub : lvalue {
248 my $x;
249 }
250 ;
251}
252####
507a68aa 253# method
ad46c0be
RH
254{
255 my $test = sub : method {
256 my $x;
257 }
258 ;
259}
260####
507a68aa 261# block with continue
87a42246 262{
ad46c0be 263 234;
f99a63a2 264}
ad46c0be
RH
265continue {
266 123;
87a42246 267}
ce4e655d 268####
507a68aa 269# lexical and package scalars
ce4e655d
RH
270my $x;
271print $main::x;
272####
507a68aa 273# lexical and package arrays
ce4e655d
RH
274my @x;
275print $main::x[1];
14a55f98 276####
507a68aa 277# lexical and package hashes
14a55f98
RH
278my %x;
279$x{warn()};
ad8caead 280####
507a68aa 281# <>
ad8caead
RGS
282my $foo;
283$_ .= <ARGV> . <$foo>;
cef22867 284####
507a68aa 285# \x{}
11454c59 286my $foo = "Ab\x{100}\200\x{200}\237Cd\000Ef\x{1000}\cA\x{2000}\cZ";
4ae52e81 287####
507a68aa 288# s///e
4ae52e81 289s/x/'y';/e;
241416b8 290####
507a68aa 291# block
241416b8
DM
292{ my $x; }
293####
507a68aa 294# while 1
241416b8
DM
295while (1) { my $k; }
296####
507a68aa 297# trailing for
241416b8
DM
298my ($x,@a);
299$x=1 for @a;
300>>>>
301my($x, @a);
0bb5f065 302$x = 1 foreach (@a);
241416b8 303####
507a68aa 304# 2 arguments in a 3 argument for
241416b8
DM
305for (my $i = 0; $i < 2;) {
306 my $z = 1;
307}
308####
507a68aa 309# 3 argument for
241416b8
DM
310for (my $i = 0; $i < 2; ++$i) {
311 my $z = 1;
312}
313####
507a68aa 314# 3 argument for again
241416b8
DM
315for (my $i = 0; $i < 2; ++$i) {
316 my $z = 1;
317}
318####
507a68aa 319# while/continue
241416b8
DM
320my $i;
321while ($i) { my $z = 1; } continue { $i = 99; }
322####
507a68aa 323# foreach with my
09d856fb 324foreach my $i (1, 2) {
241416b8
DM
325 my $z = 1;
326}
327####
507a68aa 328# foreach
241416b8
DM
329my $i;
330foreach $i (1, 2) {
331 my $z = 1;
332}
333####
507a68aa 334# foreach, 2 mys
241416b8
DM
335my $i;
336foreach my $i (1, 2) {
337 my $z = 1;
338}
339####
507a68aa 340# foreach
241416b8
DM
341foreach my $i (1, 2) {
342 my $z = 1;
343}
344####
507a68aa 345# foreach with our
241416b8
DM
346foreach our $i (1, 2) {
347 my $z = 1;
348}
349####
507a68aa 350# foreach with my and our
241416b8
DM
351my $i;
352foreach our $i (1, 2) {
353 my $z = 1;
354}
3ac6e0f9 355####
507a68aa 356# reverse sort
3ac6e0f9
RGS
357my @x;
358print reverse sort(@x);
359####
507a68aa 360# sort with cmp
3ac6e0f9
RGS
361my @x;
362print((sort {$b cmp $a} @x));
363####
507a68aa 364# reverse sort with block
3ac6e0f9
RGS
365my @x;
366print((reverse sort {$b <=> $a} @x));
36d57d93 367####
507a68aa 368# foreach reverse
36d57d93
RGS
369our @a;
370print $_ foreach (reverse @a);
aae53c41 371####
507a68aa 372# foreach reverse (not inplace)
aae53c41
RGS
373our @a;
374print $_ foreach (reverse 1, 2..5);
f86ea535 375####
507a68aa 376# bug #38684
f86ea535
SM
377our @ary;
378@ary = split(' ', 'foo', 0);
31c6271a 379####
507a68aa 380# bug #40055
31c6271a
RD
381do { () };
382####
507a68aa 383# bug #40055
31c6271a 384do { my $x = 1; $x };
d9002312 385####
507a68aa 386# <20061012113037.GJ25805@c4.convolution.nl>
d9002312
SM
387my $f = sub {
388 +{[]};
389} ;
8b2d6640 390####
507a68aa 391# bug #43010
8b2d6640
FC
392'!@$%'->();
393####
507a68aa 394# bug #43010
8b2d6640
FC
395::();
396####
507a68aa 397# bug #43010
8b2d6640
FC
398'::::'->();
399####
507a68aa 400# bug #43010
8b2d6640 401&::::;
09d856fb 402####
507a68aa 403# variables as method names
09d856fb
CK
404my $bar;
405'Foo'->$bar('orz');
35a99a08 406'Foo'->$bar('orz') = 'a stranger stranger than before';
09d856fb 407####
507a68aa 408# constants as method names
09d856fb
CK
409'Foo'->bar('orz');
410####
507a68aa 411# constants as method names without ()
09d856fb 412'Foo'->bar;
0ced6c29 413####
e9c69003 414# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
507a68aa 415# say
7ddd1a01
NC
416say 'foo';
417####
e9c69003 418# SKIP ?$] < 5.010 && "state vars not implemented on this Perl version"
507a68aa 419# state vars
0ced6c29
RGS
420state $x = 42;
421####
e9c69003 422# SKIP ?$] < 5.010 && "state vars not implemented on this Perl version"
507a68aa 423# state var assignment
7ddd1a01
NC
424{
425 my $y = (state $x = 42);
426}
427####
e9c69003 428# SKIP ?$] < 5.010 && "state vars not implemented on this Perl version"
c4a6f826 429# state vars in anonymous subroutines
7ddd1a01
NC
430$a = sub {
431 state $x;
432 return $x++;
433}
434;
644741fd
NC
435####
436# SKIP ?$] < 5.011 && 'each @array not implemented on this Perl version'
507a68aa 437# each @array;
644741fd
NC
438each @ARGV;
439each @$a;
440####
441# SKIP ?$] < 5.011 && 'each @array not implemented on this Perl version'
507a68aa 442# keys @array; values @array
644741fd
NC
443keys @$a if keys @ARGV;
444values @ARGV if values @$a;
35925e80 445####
507a68aa 446# Anonymous arrays and hashes, and references to them
35925e80
RGS
447my $a = {};
448my $b = \{};
449my $c = [];
450my $d = \[];
9210de83
FR
451####
452# SKIP ?$] < 5.010 && "smartmatch and given/when not implemented on this Perl version"
507a68aa 453# implicit smartmatch in given/when
9210de83
FR
454given ('foo') {
455 when ('bar') { continue; }
456 when ($_ ~~ 'quux') { continue; }
457 default { 0; }
458}
7ecdd211 459####
507a68aa 460# conditions in elsifs (regression in change #33710 which fixed bug #37302)
7ecdd211
PJ
461if ($a) { x(); }
462elsif ($b) { x(); }
463elsif ($a and $b) { x(); }
464elsif ($a or $b) { x(); }
465else { x(); }
03b22f1b 466####
507a68aa 467# interpolation in regexps
03b22f1b
RGS
468my($y, $t);
469/x${y}z$t/;
227375e1 470####
4a4b8592 471# TODO new undocumented cpan-bug #33708
507a68aa 472# cpan-bug #33708
227375e1
RU
473%{$_ || {}}
474####
4a4b8592 475# TODO hash constants not yet fixed
507a68aa 476# cpan-bug #33708
227375e1
RU
477use constant H => { "#" => 1 }; H->{"#"}
478####
4a4b8592 479# TODO optimized away 0 not yet fixed
507a68aa 480# cpan-bug #33708
227375e1 481foreach my $i (@_) { 0 }
edbe35ea 482####
507a68aa 483# tests with not, not optimized
07f3cdf5 484my $c;
edbe35ea
VP
485x() unless $a;
486x() if not $a and $b;
487x() if $a and not $b;
488x() unless not $a and $b;
489x() unless $a and not $b;
490x() if not $a or $b;
491x() if $a or not $b;
492x() unless not $a or $b;
493x() unless $a or not $b;
07f3cdf5
VP
494x() if $a and not $b and $c;
495x() if not $a and $b and not $c;
496x() unless $a and not $b and $c;
497x() unless not $a and $b and not $c;
498x() if $a or not $b or $c;
499x() if not $a or $b or not $c;
500x() unless $a or not $b or $c;
501x() unless not $a or $b or not $c;
edbe35ea 502####
507a68aa 503# tests with not, optimized
07f3cdf5 504my $c;
edbe35ea
VP
505x() if not $a;
506x() unless not $a;
507x() if not $a and not $b;
508x() unless not $a and not $b;
509x() if not $a or not $b;
510x() unless not $a or not $b;
07f3cdf5
VP
511x() if not $a and not $b and $c;
512x() unless not $a and not $b and $c;
513x() if not $a or not $b or $c;
514x() unless not $a or not $b or $c;
515x() if not $a and not $b and not $c;
516x() unless not $a and not $b and not $c;
517x() if not $a or not $b or not $c;
518x() unless not $a or not $b or not $c;
519x() unless not $a or not $b or not $c;
edbe35ea 520>>>>
07f3cdf5 521my $c;
edbe35ea
VP
522x() unless $a;
523x() if $a;
524x() unless $a or $b;
525x() if $a or $b;
526x() unless $a and $b;
07f3cdf5
VP
527x() if $a and $b;
528x() if not $a || $b and $c;
529x() unless not $a || $b and $c;
530x() if not $a && $b or $c;
531x() unless not $a && $b or $c;
532x() unless $a or $b or $c;
533x() if $a or $b or $c;
534x() unless $a and $b and $c;
535x() if $a and $b and $c;
536x() unless not $a && $b && $c;
71c4dbc3 537####
507a68aa 538# tests that should be constant folded
71c4dbc3
VP
539x() if 1;
540x() if GLIPP;
541x() if !GLIPP;
542x() if GLIPP && GLIPP;
543x() if !GLIPP || GLIPP;
544x() if do { GLIPP };
545x() if do { no warnings 'void'; 5; GLIPP };
546x() if do { !GLIPP };
547if (GLIPP) { x() } else { z() }
548if (!GLIPP) { x() } else { z() }
549if (GLIPP) { x() } elsif (GLIPP) { z() }
550if (!GLIPP) { x() } elsif (GLIPP) { z() }
551if (GLIPP) { x() } elsif (!GLIPP) { z() }
552if (!GLIPP) { x() } elsif (!GLIPP) { z() }
553if (!GLIPP) { x() } elsif (!GLIPP) { z() } elsif (GLIPP) { t() }
554if (!GLIPP) { x() } elsif (!GLIPP) { z() } elsif (!GLIPP) { t() }
555if (!GLIPP) { x() } elsif (!GLIPP) { z() } elsif (!GLIPP) { t() }
556>>>>
557x();
558x();
559'???';
560x();
561x();
562x();
563x();
564do {
565 '???'
566};
567do {
568 x()
569};
570do {
571 z()
572};
573do {
574 x()
575};
576do {
577 z()
578};
579do {
580 x()
581};
582'???';
583do {
584 t()
585};
586'???';
587!1;
588####
719c50dc
RGS
589# TODO constant deparsing has been backed out for 5.12
590# XXXTODO ? $Config::Config{useithreads} && "doesn't work with threads"
507a68aa 591# tests that shouldn't be constant folded
ac0f1413
NC
592# It might be fundamentally impossible to make this work on ithreads, in which
593# case the TODO should become a SKIP
71c4dbc3
VP
594x() if $a;
595if ($a == 1) { x() } elsif ($b == 2) { z() }
596if (do { foo(); GLIPP }) { x() }
597if (do { $a++; GLIPP }) { x() }
598>>>>
599x() if $a;
600if ($a == 1) { x(); } elsif ($b == 2) { z(); }
2990415a
FR
601if (do { foo(); GLIPP }) { x(); }
602if (do { ++$a; GLIPP }) { x(); }
603####
0fa4a265 604# TODO constant deparsing has been backed out for 5.12
507a68aa 605# tests for deparsing constants
2990415a
FR
606warn PI;
607####
0fa4a265 608# TODO constant deparsing has been backed out for 5.12
507a68aa 609# tests for deparsing imported constants
3779476a 610warn O_TRUNC;
2990415a 611####
0fa4a265 612# TODO constant deparsing has been backed out for 5.12
507a68aa 613# tests for deparsing re-exported constants
2990415a
FR
614warn O_CREAT;
615####
0fa4a265 616# TODO constant deparsing has been backed out for 5.12
507a68aa 617# tests for deparsing imported constants that got deleted from the original namespace
aaf9c2b2 618warn O_APPEND;
2990415a 619####
0fa4a265
DM
620# TODO constant deparsing has been backed out for 5.12
621# XXXTODO ? $Config::Config{useithreads} && "doesn't work with threads"
507a68aa 622# tests for deparsing constants which got turned into full typeglobs
ac0f1413
NC
623# It might be fundamentally impossible to make this work on ithreads, in which
624# case the TODO should become a SKIP
2990415a
FR
625warn O_EXCL;
626eval '@Fcntl::O_EXCL = qw/affe tiger/;';
627warn O_EXCL;
628####
0fa4a265 629# TODO constant deparsing has been backed out for 5.12
507a68aa 630# tests for deparsing of blessed constant with overloaded numification
2990415a 631warn OVERLOADED_NUMIFICATION;
79289e05
NC
632####
633# TODO Only strict 'refs' currently supported
507a68aa 634# strict
79289e05
NC
635no strict;
636$x;
637####
638# TODO Subsets of warnings could be encoded textually, rather than as bitflips.
507a68aa 639# subsets of warnings
79289e05
NC
640no warnings 'deprecated';
641my $x;
642####
643# TODO Better test for CPAN #33708 - the deparsed code has different behaviour
507a68aa 644# CPAN #33708
79289e05
NC
645use strict;
646no warnings;
647
648foreach (0..3) {
649 my $x = 2;
650 {
651 my $x if 0;
652 print ++$x, "\n";
653 }
654}
d83f38d8 655####
507a68aa 656# no attribute list
d83f38d8
NC
657my $pi = 4;
658####
2dc78664
NC
659# SKIP ?$] > 5.013006 && ":= is now a syntax error"
660# := treated as an empty attribute list
d83f38d8
NC
661no warnings;
662my $pi := 4;
663>>>>
664no warnings;
665my $pi = 4;
666####
507a68aa 667# : = empty attribute list
d83f38d8
NC
668my $pi : = 4;
669>>>>
670my $pi = 4;
689e417f 671####
507a68aa 672# in place sort
689e417f
VP
673our @a;
674my @b;
675@a = sort @a;
676@b = sort @b;
677();
678####
507a68aa 679# in place reverse
689e417f
VP
680our @a;
681my @b;
682@a = reverse @a;
683@b = reverse @b;
684();
06fc6867 685####
507a68aa 686# #71870 Use of uninitialized value in bitwise and B::Deparse
06fc6867
VP
687my($r, $s, @a);
688@a = split(/foo/, $s, 0);
689$r = qr/foo/;
690@a = split(/$r/, $s, 0);
691();
98a1a137 692####
507a68aa 693# package declaration before label
98a1a137
Z
694{
695 package Foo;
696 label: print 123;
697}
538f5756 698####
507a68aa 699# shift optimisation
538f5756
RZ
700shift;
701>>>>
702shift();
703####
507a68aa 704# shift optimisation
538f5756
RZ
705shift @_;
706####
507a68aa 707# shift optimisation
538f5756
RZ
708pop;
709>>>>
710pop();
711####
507a68aa 712# shift optimisation
538f5756 713pop @_;
a539498a 714####
507a68aa 715#[perl #20444]
a539498a
FC
716"foo" =~ (1 ? /foo/ : /bar/);
717"foo" =~ (1 ? y/foo// : /bar/);
718"foo" =~ (1 ? s/foo// : /bar/);
719>>>>
720'foo' =~ ($_ =~ /foo/);
721'foo' =~ ($_ =~ tr/fo//);
722'foo' =~ ($_ =~ s/foo//);
e0ab66ad
NC
723####
724# Test @threadsv_names under 5005threads
725foreach $' (1, 2) {
726 sleep $';
727}
e7afc405
FC
728####
729# y///r
730tr/a/b/r;
cb8157e3
FC
731####
732# y/uni/code/
733tr/\x{345}/\x{370}/;
cb8578ff
FC
734####
735# [perl #90898]
f4002a4b 736<a,>;
09dcfa7d
FC
737####
738# [perl #91008]
739each $@;
740keys $~;
741values $!;
5d8c42c2
FC
742####
743# readpipe with complex expression
744readpipe $a + $b;
93bad3fd
NC
745####
746# aelemfast
747$b::a[0] = 1;
748####
749# aelemfast for a lexical
750my @a;
751$a[0] = 1;
80e3f4ad
FC
752####
753# feature features without feature
754BEGIN {
755 delete $^H{'feature_say'};
756 delete $^H{'feature_state'};
757 delete $^H{'feature_switch'};
758}
759CORE::state $x;
760CORE::say $x;
761CORE::given ($x) {
762 CORE::when (3) {
763 continue;
764 }
765 CORE::default {
e36901c8 766 CORE::break;
80e3f4ad
FC
767 }
768}