require 'test.pl';
}
use warnings;
-plan( tests => 160 );
+plan( tests => 165 );
# these shouldn't hang
{
{},
'[perl #77930] cx_stack reallocation during sort'
;
+
+# [perl #76026]
+# Match vars should not leak from one sort sub call to the next
+{
+ my $output = '';
+ sub soarter {
+ $output .= $1;
+ "Leakage" =~ /(.*)/;
+ 1
+ }
+ sub soarterdd($$) {
+ $output .= $1;
+ "Leakage" =~ /(.*)/;
+ 1
+ }
+
+ "Win" =~ /(.*)/;
+ my @b = sort soarter 0..2;
+
+ like $output, qr/^(?:Win)+\z/,
+ "Match vars do not leak from one plain sort sub to the next";
+
+ $output = '';
+
+ "Win" =~ /(.*)/;
+ @b = sort soarterdd 0..2;
+
+ like $output, qr/^(?:Win)+\z/,
+ 'Match vars do not leak from one $$ sort sub to the next';
+}
+
+# [perl #30661] autoloading
+AUTOLOAD { $b <=> $a }
+sub stubbedsub;
+is join("", sort stubbedsub split//, '04381091'), '98431100',
+ 'stubborn AUTOLOAD';
+is join("", sort hopefullynonexistent split//, '04381091'), '98431100',
+ 'AUTOLOAD without stub';
+my $stubref = \&givemeastub;
+is join("", sort $stubref split//, '04381091'), '98431100',
+ 'AUTOLOAD with stubref';