1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
use strict;
use warnings;
use Test::More tests => 3;
use lib 't/lib';
use vendorlib;
# check that we can load core XS and non-XS modules
use Data::Dumper;
use File::Basename;
use Config;
eval "require Foo;";
ok $@, '@INC scrubbed';
# test bare tilde expansion
SKIP: {
skip 'no tilde expansion on Win32', 1 if $^O eq 'MSWin32';
local @INC;
my %config = %Config;
*vendorlib::Config = \%config;
local $config{vendorarch} = '~/';
vendorlib->import;
my $expanded = (getpwuid($<))[7] . '/';
skip 'home directory reported by getpwuid does not exist', 1 unless -d $expanded;
shift @INC if $INC[0] eq '/etc/perl';
is $INC[0], $expanded, 'bare tilde expansion';
}
# test tilde expansion with user name
SKIP: {
skip 'no tilde expansion on Win32', 1 if $^O eq 'MSWin32';
local @INC;
my %config = %Config;
*vendorlib::Config = \%config;
my $whoami = (getpwuid($<))[0];
local $config{vendorarch} = "~${whoami}/";
vendorlib->import;
my $expanded = (getpwuid($<))[7] . '/';
skip 'home directory reported by getpwuid does not exist', 1 unless -d $expanded;
shift @INC if $INC[0] eq '/etc/perl';
is $INC[0], $expanded, 'tilde expansion with user name';
}
|