This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge gv_AVadd(), gv_HVadd() and gv_SVadd() into gv_add_by_type().
[perl5.git] / lib / lib.t
index 9a86ac7..5d4ff3a 100644 (file)
--- a/lib/lib.t
+++ b/lib/lib.t
@@ -2,11 +2,12 @@
 
 BEGIN {
     chdir 't';
-    @INC = '../lib';
+    unshift @INC, '..';
+    unshift @INC, '../lib';
     @OrigINC = @INC;
 }
 
-use Test::More tests => 12;
+use Test::More tests => 13;
 use Config;
 use File::Spec;
 use File::Path;
@@ -51,13 +52,25 @@ use lib $Lib_Dir;
 BEGIN { use_ok('Yup') }
 
 BEGIN {
+    if ($^O eq 'MacOS') {
+       for ($Lib_Dir, $Arch_Dir) {
+           tr|/|:|;
+           $_ .= ":" unless /:$/;
+           $_ = ":$_" unless /^:/; # we know this path is relative
+       }
+    }
     is( $INC[1], $Lib_Dir,          'lib adding at end of @INC' );
     print "# \@INC == @INC\n";
     is( $INC[0], $Arch_Dir,        '    auto/ dir in front of that' );
     is( grep(/^\Q$Lib_Dir\E$/, @INC), 1,   '    no duplicates' );
 
     # Yes, %INC uses Unixy filepaths.
-    is( $INC{'Yup.pm'}, join("/",$Lib_Dir, 'Yup.pm'),    '%INC set properly' );
+    # Not on Mac OS, it doesn't ... it never has, at least.
+    my $path = join("/",$Lib_Dir, 'Yup.pm');
+    if ($^O eq 'MacOS') {
+       $path = $Lib_Dir . 'Yup.pm';
+    }
+    is( $INC{'Yup.pm'}, $path,    '%INC set properly' );
 
     is( eval { do 'Yup.pm'  }, 42,  'do() works' );
     ok( eval { require Yup; },      '   require()' );
@@ -69,6 +82,9 @@ BEGIN {
 
 no lib $Lib_Dir;
 
+unlike( do { eval 'use lib $Config{installsitelib};'; $@ || '' },
+       qr/::Config is read-only/, 'lib handles readonly stuff' );
+
 BEGIN {
     is( grep(/stuff/, @INC), 0, 'no lib' );
     ok( !do 'Yup.pm',           '   do() effected' );