3 # Test the well-formed-ness of the MANIFEST file.
6 @INC = '..' if -f '../TestInit.pm';
8 use TestInit qw(T); # T is chdir to the top level
14 my $manifest = 'MANIFEST';
16 open my $m, '<', $manifest or die "Can't open '$manifest': $!";
18 # Test that MANIFEST uses tabs - not spaces - after the name of the file.
23 # no need for further tests on lines without whitespace (i.e., filename only)
26 my ($file, $separator) = /^(\S+)(\s+)/;
29 isnt($file, undef, "Line $. doesn't start with a blank") or next;
30 ok(-f $file, "File $file exists");
31 if ($separator !~ tr/\t//c) {
34 } elsif ($separator !~ tr/ //c) {
36 fail("Spaces in entry for $file");
37 } elsif ($separator =~ tr/\t//) {
38 fail("Mixed tabs and spaces in entry for $file");
40 fail("Odd whitespace in entry for $file");
46 # Test that MANIFEST is properly sorted
48 skip("'Porting/manisort' not found", 1) if (! -f 'Porting/manisort');
50 my $result = runperl('progfile' => 'Porting/manisort',
51 'args' => [ '-c', $manifest ],
54 like($result, qr/is sorted properly/, 'MANIFEST sorted properly');
59 chomp(my @repo= grep { !/\.gitignore$/ } `git ls-files`);
60 skip("git ls-files didnt work",3)
62 is( 0+@repo, 0+@files, "git ls-files gives the same number of files as MANIFEST lists");
63 my %repo= map { $_ => 1 } @repo;
64 my %mani= map { $_ => 1 } @files;
65 is( 0+keys %mani, 0+@files, "no duplicate files in MANIFEST");
66 delete $mani{$_} for @repo;
67 delete $repo{$_} for @files;
68 my @not_in_mani= keys %repo;
69 my @still_in_mani= keys %mani;
71 is( 0+@not_in_mani, 0, "Nothing added to the repo that isn't in MANIFEST");
72 is( "not in MANIFEST: @not_in_mani", "not in MANIFEST: ",
73 "Nothing added to the repo that isn't in MANIFEST");
74 is( 0+@still_in_mani, 0, "Nothing in the MANIFEST that isn't tracked by git");
75 is( "should not be in MANIFEST: @still_in_mani", "should not be in MANIFEST: ",
76 "Nothing in the MANIFEST that isn't tracked by git");