7 use Test::More tests => 13;
12 #set up files and directories
19 # lib.pm is documented to only work with Unix filepaths.
20 @lib_dir = qw(stuff moo);
21 $Lib_Dir = join "/", @lib_dir;
22 $Arch_Dir = join "/", @lib_dir, $Config{archname};
24 # create the auto/ directory and a module
25 $Auto_Dir = File::Spec->catdir(@lib_dir, $Config{archname},'auto');
26 $Module = File::Spec->catfile(@lib_dir, 'Yup.pm');
30 open(MOD, ">$Module") || DIE $!;
41 # cleanup the auto/ directory we created.
42 rmtree([$lib_dir[0]]);
49 BEGIN { use_ok('Yup') }
52 is( $INC[1], $Lib_Dir, 'lib adding at end of @INC' );
53 print "# \@INC == @INC\n";
54 is( $INC[0], $Arch_Dir, ' auto/ dir in front of that' );
55 is( grep(/^\Q$Lib_Dir\E$/, @INC), 1, ' no duplicates' );
57 # Yes, %INC uses Unixy filepaths.
58 # Not on Mac OS, it doesn't ... it never has, at least.
59 my $path = join("/",$Lib_Dir, 'Yup.pm');
60 is( $INC{'Yup.pm'}, $path, '%INC set properly' );
62 is( eval { do 'Yup.pm' }, 42, 'do() works' );
63 ok( eval { require Yup; }, ' require()' );
64 ok( eval "use Yup; 1;", ' use()' );
67 is_deeply(\@OrigINC, \@lib::ORIG_INC, '@lib::ORIG_INC' );
72 unlike( do { eval 'use lib $Config{installsitelib};'; $@ || '' },
73 qr/::Config is read-only/, 'lib handles readonly stuff' );
76 is( grep(/stuff/, @INC), 0, 'no lib' );
77 ok( !do 'Yup.pm', ' do() effected' );