ExtUtils::MakeMaker 6.54
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / installed_file.t
1 #!/usr/bin/perl -w
2
3 # Test MM->_installed_file_for_module()
4
5 BEGIN {
6     chdir 't' if -d 't';
7
8     if( $ENV{PERL_CORE} ) {
9         @INC = '../lib';
10     }
11 }
12
13 use strict;
14 use warnings;
15
16 use lib './lib';
17 use ExtUtils::MakeMaker;
18 use Test::More;
19 use File::Spec;
20
21
22 sub path_is {
23     my($have, $want, $name) = @_;
24
25     $have = File::Spec->canonpath($have);
26     $want = File::Spec->canonpath($want);
27
28     my $builder = Test::More->builder;
29     return $builder->is_eq( $have, $want, $name );
30 }
31
32 # Test when a module is not installed
33 {
34     ok !MM->_installed_file_for_module("aaldkfjaldj"), "Module not installed";
35     ok !MM->_installed_file_for_module("aaldkfjaldj::dlajldkj");
36 }
37
38 # Try a single name module
39 {
40     my $want = $INC{'strict.pm'};
41     path_is( MM->_installed_file_for_module("strict"), $want,  "single name module" );
42 }
43
44 # And a tuple
45 {
46     my $want = $INC{"Test/More.pm"};
47     path_is( MM->_installed_file_for_module("Test::More"), $want, "Foo::Bar style" );
48 }
49
50
51 done_testing(4);