82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / installed_file.t
CommitLineData
75e3c8a3 1#!/usr/bin/perl -w
2
3# Test MM->_installed_file_for_module()
4
d00e3d8a 5BEGIN {
6 chdir 't' if -d 't';
d00e3d8a 7}
8
75e3c8a3 9use strict;
10use warnings;
b78fd716 11use less;
75e3c8a3 12
d00e3d8a 13use lib './lib';
75e3c8a3 14use ExtUtils::MakeMaker;
15use Test::More;
16use File::Spec;
17
18
19sub 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{
b78fd716 37 my $want = $INC{'less.pm'};
38 path_is( MM->_installed_file_for_module("less"), $want, "single name module" );
75e3c8a3 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
48done_testing(4);