summaryrefslogtreecommitdiff
path: root/lib/sort.t
diff options
context:
space:
mode:
authorRobin Houston <robin@cpan.org>2006-04-02 18:20:24 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-04-02 21:13:16 +0000
commitf4f44d658c5179458c57c4af43429aac25bf8546 (patch)
tree923d398b4a2556e81e6b8454ae78aef91dd334e4 /lib/sort.t
parent9f7f391326e967b539b86ed051c163bbf8f6e7de (diff)
downloadperl-f4f44d658c5179458c57c4af43429aac25bf8546.tar.gz
Prevent "use sort 'stable'" from reversing the order
Message-ID: <20060402162024.GA3854@rpc142.cs.man.ac.uk> p4raw-id: //depot/perl@27689
Diffstat (limited to 'lib/sort.t')
-rw-r--r--lib/sort.t5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sort.t b/lib/sort.t
index 62c5529c21..ca809b0ffa 100644
--- a/lib/sort.t
+++ b/lib/sort.t
@@ -26,7 +26,7 @@ use strict;
use warnings;
use Test::More tests => @TestSizes * 2 # sort() tests
- * 4 # number of pragmas to test
+ * 6 # number of pragmas to test
+ 1 # extra test for qsort instability
+ 3 # tests for sort::current
+ 3; # tests for "defaults" and "no sort"
@@ -163,16 +163,19 @@ main(sub { sort {&{$_[0]}} @{$_[1]} }, 0);
no sort qw(_qsort);
my $sort_current; BEGIN { $sort_current = sort::current(); }
is($sort_current, 'stable', 'sort::current after no _qsort');
+ main(sub { sort {&{$_[0]}} @{$_[1]} }, 0);
}
{
use sort qw(defaults _qsort);
my $sort_current; BEGIN { $sort_current = sort::current(); }
is($sort_current, 'quicksort', 'sort::current after defaults _qsort');
+ # Not expected to be stable, so don't test for stability here
}
{
use sort qw(defaults stable);
my $sort_current; BEGIN { $sort_current = sort::current(); }
is($sort_current, 'stable', 'sort::current after defaults stable');
+ main(sub { sort {&{$_[0]}} @{$_[1]} }, 0);
}