use lib qw[../lib to_load];
use File::Spec ();
-use Test::More tests => 20;
+use Test::More tests => 23;
### case 1 ###
-use_ok( 'Module::Load::Conditional' ) or diag "Module.pm not found. Dying", die;
+use_ok( 'Module::Load::Conditional' );
### stupid stupid warnings ###
{ $Module::Load::Conditional::VERBOSE =
ok( $rv->{version} == $Module::Load::Conditional::VERSION,
q[ Found proper version] );
+ # This test is expecting the file to in UNIX format, so force
+ $rv->{file} = VMS::Filespec::unixify($rv->{file}) if $^O eq 'VMS';
+
+ # break up the specification
+ my @rv_path;
+ if ($^O eq 'VMS') {
+ # Use the UNIX specific method, as the VMS one currently
+ # converts the file spec back to VMS format.
+ @rv_path = File::Spec::Unix->splitpath($rv->{file});
+ } else {
+ @rv_path = File::Spec->splitpath($rv->{file});
+ }
+
+ # First element could be blank for some system types like VMS
+ shift @rv_path if $rv_path[0] eq '';
+
ok( $INC{'Module/Load/Conditional.pm'} eq
- File::Spec::Unix->catfile(File::Spec->splitdir($rv->{file}) ),
+ File::Spec::Unix->catfile(@rv_path),
q[ Found proper file]
);
}
-### test $FILE_VERSION
+### test finding a version of a module that mentions $VERSION in pod
+{ my $rv = check_install( module => 'InPod' );
+ ok( $rv, 'Testing $VERSION in POD' );
+ ok( $rv->{version}, " Version found" );
+ is( $rv->{version}, 2, " Version is correct" );
+}
+
+### test $FIND_VERSION
{ local $Module::Load::Conditional::FIND_VERSION = 0;
local $Module::Load::Conditional::FIND_VERSION = 0;
### test 'requires' ###
-
SKIP:{
skip "Depends on \$^X, which doesn't work well when testing the Perl core",
1 if $ENV{PERL_CORE};
- my %list = map { $_ => 1 } requires('Carp');
+ my %list = map { $_ => 1 } requires('Carp');
+
my $flag;
$flag++ unless delete $list{'Exporter'};
ok( !$flag, q[Detecting requirements] );
}
-
-
### test using the %INC lookup for check_install
{ local $Module::Load::Conditional::CHECK_INC_HASH = 1;
local $Module::Load::Conditional::CHECK_INC_HASH = 1;
{ package A::B::C::D;
$A::B::C::D::VERSION = $$;
$INC{'A/B/C/D.pm'} = $$.$$;
+ $INC{'[.A.B.C]D.pm'} = $$.$$ if $^O eq 'VMS';
}
my $href = check_install( module => 'A::B::C::D', version => 0 );
' can_load successful' );
}
-