In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/3d967d9abef744c6fe8f4b6b7434a38c59380228?hp=ef314d296a4a0765d59203c399398dbd0a97fcc5>

- Log -----------------------------------------------------------------
commit 3d967d9abef744c6fe8f4b6b7434a38c59380228
Author: Nicholas Clark <[email protected]>
Date:   Wed Jul 29 22:36:33 2009 +0100

    Avoid shelling out to an external sort to verify that MANIFEST is sorted.
    
    This also lets us report which file(s) are out of order.
-----------------------------------------------------------------------

Summary of changes:
 t/lib/manifest.t |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/t/lib/manifest.t b/t/lib/manifest.t
index ea40708..bbf038a 100644
--- a/t/lib/manifest.t
+++ b/t/lib/manifest.t
@@ -17,13 +17,30 @@ my $manifest = File::Spec->catfile(File::Spec->updir(), 
'MANIFEST');
 
 open my $m, '<', $manifest or die "Can't open '$manifest': $!";
 
+my $last_seen = '';
+my $sorted = 1;
+
 # Test that MANIFEST uses tabs - not spaces - after the name of the file.
 while (<$m>) {
     chomp;
-    next unless /\s/;   # Ignore lines without whitespace (i.e., filename only)
-    my ($file, $separator) = /^(\S+)(\s+)/;
+
+    my ($file, $separator) = /^(\S+)(\s*)/;
     isnt($file, undef, "Line $. doesn't start with a blank") or next;
-    if ($separator !~ tr/\t//c) {
+
+    # Manifest order is "dictionary order, lowercase" for ASCII:
+    my $normalised = $_;
+    $normalised =~ tr/A-Z/a-z/;
+    $normalised =~ s/[^a-z0-9\s]//g;
+
+    if ($normalised le $last_seen) {
+       fail("Sort order broken by $file");
+       undef $sorted;
+    }
+    $last_seen = $normalised;
+
+    if (!$separator) {
+       # Ignore lines without whitespace (i.e., filename only)
+    } elsif ($separator !~ tr/\t//c) {
        # It's all tabs
        next;
     } elsif ($separator !~ tr/ //c) {
@@ -38,8 +55,6 @@ while (<$m>) {
 
 close $m or die $!;
 
-# Test that MANIFEST is properly sorted
-my $sorted = `LC_ALL=C sort -fdc $manifest 2>&1`;
-is($sorted, '', 'MANIFEST properly sorted');
+ok($sorted, 'MANIFEST properly sorted');
 
 # EOF

--
Perl5 Master Repository

Reply via email to