| 1 |
use strict; |
| 2 |
use Test::More; |
| 3 |
|
| 4 |
# Check that MANIFEST and MANIFEST.skip are sane : |
| 5 |
|
| 6 |
use File::Find; |
| 7 |
use File::Spec; |
| 8 |
|
| 9 |
my @files = qw( MANIFEST MANIFEST.SKIP ); |
| 10 |
plan tests => scalar @files * 4 |
| 11 |
+1 # MANIFEST existence check |
| 12 |
+1 # MYMETA.* non-existence check |
| 13 |
; |
| 14 |
|
| 15 |
for my $file (@files) { |
| 16 |
ok(-f $file, "$file exists"); |
| 17 |
open my $fh, '<', $file |
| 18 |
or die "Couldn't open $file : $!"; |
| 19 |
my @lines = <$fh>; |
| 20 |
is_deeply([grep(/^$/, @lines)],[], "No empty lines in $file"); |
| 21 |
is_deeply([grep(/^\s+$/, @lines)],[], "No whitespace-only lines in $file"); |
| 22 |
is_deeply([grep(/^\s*\S\s+$/, @lines)],[],"No trailing whitespace on lines in $file"); |
| 23 |
|
| 24 |
if ($file eq 'MANIFEST') { |
| 25 |
chomp @lines; |
| 26 |
is_deeply([grep { s/\s.*//; ! -f } @lines], [], "All files in $file exist") |
| 27 |
or do { diag "$_ is mentioned in $file but doesn't exist on disk" for grep { ! -f } @lines }; |
| 28 |
|
| 29 |
# Exclude some files from shipping |
| 30 |
is_deeply([grep(/^MYMETA\.(yml|json)$/, @lines)],[],"We don't try to ship MYMETA.* $file"); |
| 31 |
}; |
| 32 |
|
| 33 |
close $fh; |
| 34 |
}; |
| 35 |
|