X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F00dependencies.t;h=9b46598f735409490fd85395721153fe1b53d295;hb=32256f01d018a2a5799e706c57edef4680b3a276;hp=ac53bf06a57eccf7c8e96dbc4965a3d22a81ded8;hpb=bd645f0ff0678d2b9d1f94b9d6d547ef84411498;p=scpubgit%2Fstemmatology.git diff --git a/t/00dependencies.t b/t/00dependencies.t index ac53bf0..9b46598 100644 --- a/t/00dependencies.t +++ b/t/00dependencies.t @@ -6,7 +6,8 @@ use strict; =head1 DESCRIPTION Makes sure that all of the modules that are 'use'd are listed in the -Makefile.PL as dependencies. +Makefile.PL as dependencies. Also as long as we are source filtering, +make sure there are no $DB::single statements in the code. =cut @@ -17,6 +18,16 @@ if ($@) { plan skip_all => 'Module::CoreList not installed' } plan 'no_plan'; +my %skipped; +if( -f 'MANIFEST.SKIP' ) { + # We don't want these + open( SKIP, 'MANIFEST.SKIP' ) or die "Could not open manifest skip file"; + while() { + chomp; + $skipped{$_} = 1; + } + close SKIP; +} my %used; find( \&wanted, qw/ lib t / ); @@ -25,6 +36,7 @@ sub wanted { return if $File::Find::dir =~ m!/.git($|/)!; return if $File::Find::name =~ /~$/; return if $File::Find::name =~ /\.(pod|html)$/; + return if $skipped{$File::Find::name}; # read in the file from disk my $filename = $_; @@ -34,13 +46,17 @@ sub wanted { close(FILE); # strip pod, in a really idiotic way. Good enough though - $data =~ s/^=head.+?(^=cut|\Z)//gms; + $data =~ s/^=(begin|head).+?(^=cut|\Z)//gms; # look for use and use base statements $used{$1}{$File::Find::name}++ while $data =~ /^\s*use\s+([\w:]+)/gm; while ( $data =~ m|^\s*use base qw.([\w\s:]+)|gm ) { $used{$_}{$File::Find::name}++ for split ' ', $1; } + # look for DB statements while we are here + while( $data =~ /^\s*\$DB::single/gm ) { + fail( "DB::single statement present in source " . $File::Find::name ); + } } my %required; @@ -60,7 +76,7 @@ my %required; for ( sort keys %used ) { my $first_in = Module::CoreList->first_release($_); next if defined $first_in and $first_in <= 5.00803; - next if /^(Text::Tradition|inc|t)(::|$)/; + next if /^(Text::Tradition|inc|t|feature)(::|$)/; #warn $_; ok( exists $required{$_}, "$_ in Makefile.PL" )