Created
February 11, 2013 02:03
-
-
Save bayashi/4751969 to your computer and use it in GitHub Desktop.
Test: : Do NOT load modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Test::AllModules; | |
use Test::More; | |
BEGIN { | |
note('compile all modules.'); | |
all_ok( | |
search_path => 'MyApp', | |
check => sub { | |
my $class = shift; | |
eval "use $class;1;"; | |
}, | |
); | |
} | |
note('Do NOT load modules.'); | |
for my $module (qw/ | |
Class::ISA Pod::Plainer Switch UNIVERSAL Shell FileHandle DynaLoader base byte | |
/) { | |
ok noload($module), "no $module"; | |
} | |
sub noload { | |
my $module = shift; | |
$module =~ s!::!/!g; | |
return !defined( $INC{"$module\.pm"} ) ? 1 : 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment