1 ### Module::Load test suite ###
3 if( $ENV{PERL_CORE} ) {
4 chdir '../lib/Module/Load' if -d '../lib/Module/Load';
5 unshift @INC, '../../..';
9 BEGIN { chdir 't' if -d 't' }
12 use lib qw[../lib to_load];
14 use Test::More tests => 13;
18 my $mod = 'Must::Be::Loaded';
19 my $file = Module::Load::_to_file($mod,1);
21 # %INC on VMS has all keys in UNIX format
22 $file = VMS::Filespec::unixify($file) if $^O eq 'VMS';
26 is( $@, '', qq[Loading module '$mod'] );
27 ok( defined($INC{$file}), q[... found in %INC] );
31 my $mod = 'LoadMe.pl';
32 my $file = Module::Load::_to_file($mod);
36 is( $@, '', qq[Loading File '$mod'] );
37 ok( defined($INC{$file}), q[... found in %INC] );
42 my $file = Module::Load::_to_file($mod,1);
46 is( $@, '', qq[Loading Ambigious Module '$mod'] );
47 ok( defined($INC{$file}), q[... found in %INC] );
51 my $mod = 'ToBeLoaded';
52 my $file = Module::Load::_to_file($mod);
56 is( $@, '', qq[Loading Ambigious File '$mod'] );
57 ok( defined($INC{$file}), q[... found in %INC] );
60 ### Test importing functions ###
61 { my $mod = 'TestModule';
62 my @funcs = qw[func1 func2];
64 eval { load $mod, @funcs };
65 is( $@, '', qq[Loaded exporter module '$mod'] );
67 for my $func (@funcs) {
68 ok( $mod->can($func), "$mod -> can( $func )" );
69 ok( __PACKAGE__->can($func), "we -> can ( $func )" );