82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / 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
9 use strict;
10 use warnings;
11 use less;
12
13 use lib './lib';
14 use ExtUtils::MakeMaker;
15 use Test::More;
16 use File::Spec;
17
18
19 sub path_is {
20     my($have, $want, $name) = @_;
21
22     $have = File::Spec->canonpath($have);
23     $want = File::Spec->canonpath($want);
24
25     my $builder = Test::More->builder;
26     return $builder->is_eq( $have, $want, $name );
27 }
28
29 # Test when a module is not installed
30 {
31     ok !MM->_installed_file_for_module("aaldkfjaldj"), "Module not installed";
32     ok !MM->_installed_file_for_module("aaldkfjaldj::dlajldkj");
33 }
34
35 # Try a single name module
36 {
37     my $want = $INC{'less.pm'};
38     path_is( MM->_installed_file_for_module("less"), $want,  "single name module" );
39 }
40
41 # And a tuple
42 {
43     my $want = $INC{"Test/More.pm"};
44     path_is( MM->_installed_file_for_module("Test::More"), $want, "Foo::Bar style" );
45 }
46
47
48 done_testing(4);