1#!/usr/bin/perl -w 2 3# Test MM->_installed_file_for_module() 4 5BEGIN { 6 chdir 't' if -d 't'; 7} 8 9use strict; 10use warnings; 11use less; 12 13use lib './lib'; 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{ 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 48done_testing(4); 49