Commit | Line | Data |
398f002c |
1 | #!./perl -w |
2 | |
b8ca42e1 |
3 | # Test the well-formed-ness of the MANIFEST file. |
398f002c |
4 | |
5 | BEGIN { |
6 | chdir 't'; |
7 | @INC = '../lib'; |
8 | } |
9 | |
10 | use strict; |
11 | use File::Spec; |
12 | require './test.pl'; |
13 | |
398f002c |
14 | plan('no_plan'); |
15 | |
16 | my $manifest = File::Spec->catfile(File::Spec->updir(), 'MANIFEST'); |
17 | |
18 | open my $m, '<', $manifest or die "Can't open '$manifest': $!"; |
19 | |
b8ca42e1 |
20 | # Test that MANIFEST uses tabs - not spaces - after the name of the file. |
398f002c |
21 | while (<$m>) { |
22 | chomp; |
4e86fc4b |
23 | next unless /\s/; # Ignore lines without whitespace (i.e., filename only) |
24 | my ($file, $separator) = /^(\S+)(\s+)/; |
398f002c |
25 | isnt($file, undef, "Line $. doesn't start with a blank") or next; |
4e86fc4b |
26 | if ($separator !~ tr/\t//c) { |
398f002c |
27 | # It's all tabs |
28 | next; |
29 | } elsif ($separator !~ tr/ //c) { |
30 | # It's all spaces |
31 | fail("Spaces in entry for $file"); |
398f002c |
32 | } elsif ($separator =~ tr/\t//) { |
33 | fail("Mixed tabs and spaces in entry for $file"); |
34 | } else { |
35 | fail("Odd whitespace in entry for $file"); |
36 | } |
37 | } |
38 | |
39 | close $m or die $!; |
40 | |
4e86fc4b |
41 | # Test that MANIFEST is properly sorted |
42 | SKIP: { |
43 | skip("'Porting/manisort' not found", 1) if (! -f '../Porting/manisort'); |
44 | |
45 | my $result = runperl('progfile' => '../Porting/manisort', |
46 | 'args' => [ '-c', '../MANIFEST' ], |
47 | 'stderr' => 1); |
48 | |
49 | like($result, qr/is sorted properly/, 'MANIFEST sorted properly'); |
50 | } |
b8ca42e1 |
51 | |
52 | # EOF |