| 1 |
#!perl -w |
| 2 |
# packaging test - make sure we included the samples in the MANIFEST <sigh> |
| 3 |
use Test::More; |
| 4 |
use ExtUtils::Manifest qw(maniread); |
| 5 |
|
| 6 |
# first build a list of samples from samples/README |
| 7 |
open SAMPLES, "< samples/README" |
| 8 |
or die "Cannot open samples/README: $!"; |
| 9 |
my @sample_files; |
| 10 |
while (<SAMPLES>) { |
| 11 |
chomp; |
| 12 |
/^\w[\w.-]+\.\w+$/ and push @sample_files, $_; |
| 13 |
} |
| 14 |
|
| 15 |
close SAMPLES; |
| 16 |
|
| 17 |
my $manifest = maniread(); |
| 18 |
|
| 19 |
my @mani_samples = sort grep m(^samples/\w+\.pl$), keys %$manifest; |
| 20 |
|
| 21 |
plan tests => scalar(@sample_files) + scalar(@mani_samples); |
| 22 |
|
| 23 |
for my $filename (@sample_files) { |
| 24 |
ok(exists($manifest->{"samples/$filename"}), |
| 25 |
"sample file $filename in manifest"); |
| 26 |
} |
| 27 |
|
| 28 |
my %files = map { $_ => 1 } @sample_files; |
| 29 |
for my $filename (@mani_samples) { |
| 30 |
$filename =~ s(^samples/)(); |
| 31 |
ok(exists $files{$filename}, |
| 32 |
"sample $filename in manifest found in README"); |
| 33 |
} |