From: Nicholas Clark Date: Tue, 13 Jul 2004 15:05:09 +0000 (+0000) Subject: check that reverse (sort (@a), @b) etc work. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c093edd09880a1b87e82c8b6b11c8ccd0aca2d55;p=p5sagit%2Fp5-mst-13.2.git check that reverse (sort (@a), @b) etc work. Join some lines that don't need wrapping p4raw-id: //depot/perl@23100 --- diff --git a/t/op/sort.t b/t/op/sort.t index 0d0f2b3..5aa71a4 100755 --- a/t/op/sort.t +++ b/t/op/sort.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } use warnings; -print "1..125\n"; +print "1..127\n"; # these shouldn't hang { @@ -634,8 +634,7 @@ sub sortnumr { ok "@output", "I H G F E D C B A", 'reversed stable $a <=> $b sort return list context'; $output = sortnumr &generate1; -ok $output, "IHGFEDCBA", - 'reversed stable $a <=> $b sort return scalar context'; +ok $output, "IHGFEDCBA", 'reversed stable $a <=> $b sort return scalar context'; sub sortnumrba { reverse sort {$b <=> $a} @_; @@ -645,8 +644,7 @@ sub sortnumrba { ok "@output", "C B A F E D I H G", 'reversed stable $b <=> $a sort return list context'; $output = sortnumrba &generate1; -ok $output, "CBAFEDIHG", -'reversed stable $b <=> $a sort return scalar context'; +ok $output, "CBAFEDIHG", 'reversed stable $b <=> $a sort return scalar context'; sub sortnumrq { reverse sort {stuff || $a <=> $b} @_; @@ -656,5 +654,10 @@ sub sortnumrq { ok "@output", "I H G F E D C B A", 'reversed stable complex sort return list context'; $output = sortnumrq &generate1; -ok $output, "IHGFEDCBA", - 'reversed stable complex sort return scalar context'; +ok $output, "IHGFEDCBA", 'reversed stable complex sort return scalar context'; + +@output = reverse (sort(qw(C A B)), 0); +ok "@output", "0 C B A", 'reversed sort with trailing argument'; + +@output = reverse (0, sort(qw(C A B))); +ok "@output", "C B A 0", 'reversed sort with leading argument';