summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorStephen McCamant <smcc@mit.edu>1999-08-25 16:22:32 -0700
committerJarkko Hietaniemi <jhi@iki.fi>1999-08-29 15:31:36 +0000
commite507f0504293808d931970586c0530e4bb738a80 (patch)
tree333414ef625a9d0ed5a6b2e4c55883747e210ee6 /t
parentae2d1787751a38d67ea377bb8eb603cbbf3a36bc (diff)
downloadperl-e507f0504293808d931970586c0530e4bb738a80.tar.gz
Lost arguments to simplified sort
To: perl5-porters@perl.org Message-ID: <14276.56616.879390.562685@metonymy.hip.berkeley.edu> p4raw-id: //depot/cfgperl@4048
Diffstat (limited to 't')
-rwxr-xr-xt/op/sort.t10
1 files changed, 8 insertions, 2 deletions
diff --git a/t/op/sort.t b/t/op/sort.t
index 27c77a4fc4..f7bba3d263 100755
--- a/t/op/sort.t
+++ b/t/op/sort.t
@@ -4,7 +4,7 @@ BEGIN {
chdir 't' if -d 't';
unshift @INC, '../lib';
}
-print "1..37\n";
+print "1..38\n";
# XXX known to leak scalars
$ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
@@ -191,9 +191,15 @@ print "# x = '$x'; expected = '$expected'\n";
print ($x eq $expected ? "ok 36\n" : "not ok 36\n");
print "# x = '$x'; expected = '$expected'\n";
}
+
+# test that an optimized-away comparison block doesn't take any other
+# arguments away with it
+$x = join('', sort { $a <=> $b } 3, 1, 2);
+print $x eq "123" ? "ok 37\n" : "not ok 37\n";
+
# test sorting in non-main package
package Foo;
@a = ( 5, 19, 1996, 255, 90 );
@b = sort { $b <=> $a } @a;
-print ("@b" eq '1996 255 90 19 5' ? "ok 37\n" : "not ok 37\n");
+print ("@b" eq '1996 255 90 19 5' ? "ok 38\n" : "not ok 38\n");
print "# x = '@b'\n";