summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-05-30 13:29:13 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-30 13:29:13 +0000
commite69a2255d0db4d110e403864fcb97407ce8e4ff9 (patch)
treed06bcf736b723222fffb9ae32c9018de2277632a /lib
parent5df8692c9adbc24ad55369ec6cb2fef5fc7cdcaa (diff)
downloadperl-e69a2255d0db4d110e403864fcb97407ce8e4ff9.tar.gz
Integrate macperl patch #16868.
p4raw-id: //depot/perl@16882 p4raw-integrated: from //depot/macperl@16881 'copy in' ext/B/B/Concise.pm ext/B/t/deparse.t ext/B/t/terse.t ext/DynaLoader/DynaLoader_pm.PL ext/IO/lib/IO/t/io_dup.t ext/POSIX/t/sigaction.t ext/PerlIO/t/encoding.t ext/Socket/Socket.t lib/AutoSplit.t lib/Net/Ping/t/110_icmp_inst.t lib/Net/hostent.t lib/Pod/t/Usage.t lib/Pod/t/pod2html-lib.pl lib/Test/Harness/t/callback.t lib/blib.pm lib/strict.t lib/subs.t t/lib/filter-util.pl t/lib/warnings/doio t/lib/warnings/mg t/x2p/s2p.t (@16123..) lib/Test/Simple/t/exit.t (@16230..) lib/open.t lib/warnings.t (@16255..) perl.c (@16475..) lib/Unicode/Collate.pm lib/Unicode/UCD.t (@16651..) ext/PerlIO/t/fallback.t lib/Test/Harness/t/strap-analyze.t lib/Test/Harness/t/test-harness.t (@16825..) p4raw-integrated: from //depot/macperl@16868 'copy in' lib/blib.t (@16123..) t/lib/warnings/op (@16230..) ext/Cwd/t/cwd.t ext/Digest/MD5/t/files.t (@16475..) 'merge in' ext/Storable/t/utf8hash.t lib/Test/Harness/Straps.pm (@16730..)
Diffstat (limited to 'lib')
-rw-r--r--lib/AutoSplit.t32
-rw-r--r--lib/Net/Ping/t/110_icmp_inst.t2
-rw-r--r--lib/Net/hostent.t6
-rw-r--r--lib/Pod/t/Usage.t3
-rw-r--r--lib/Pod/t/pod2html-lib.pl2
-rw-r--r--lib/Test/Harness/Straps.pm4
-rw-r--r--lib/Test/Harness/t/callback.t8
-rw-r--r--lib/Test/Harness/t/strap-analyze.t12
-rw-r--r--lib/Test/Harness/t/test-harness.t13
-rw-r--r--lib/Test/Simple/t/exit.t5
-rw-r--r--lib/Unicode/Collate.pm6
-rw-r--r--lib/Unicode/UCD.t1
-rw-r--r--lib/blib.pm29
-rw-r--r--lib/blib.t31
-rw-r--r--lib/open.t1
-rw-r--r--lib/strict.t6
-rw-r--r--lib/subs.t3
-rw-r--r--lib/warnings.t28
18 files changed, 142 insertions, 50 deletions
diff --git a/lib/AutoSplit.t b/lib/AutoSplit.t
index 7cc680ef75..174902a1d8 100644
--- a/lib/AutoSplit.t
+++ b/lib/AutoSplit.t
@@ -3,8 +3,7 @@
# AutoLoader.t runs before this test, so it seems safe to assume that it will
# work.
-my $incdir;
-my $lib = '"-I../lib"'; # ok on unix, nt, The extra \" are for VMS
+my($incdir, $lib);
BEGIN {
chdir 't' if -d 't';
if ($^O eq 'dos') {
@@ -13,9 +12,10 @@ BEGIN {
}
if ($^O eq 'MacOS') {
$incdir = ":auto-$$";
- $lib = '-x -I::lib:'; # -x overcomes MPW $Config{startperl} anomaly
+ $lib = '-I::lib:';
} else {
$incdir = "auto-$$";
+ $lib = '"-I../lib"'; # ok on unix, nt, The extra \" are for VMS
}
@INC = $incdir;
push @INC, '../lib';
@@ -49,8 +49,9 @@ my @tests;
close DATA;
}
-my $pathsep = $^O eq 'MSWin32' ? '\\' : '/';
-
+my $pathsep = $^O eq 'MSWin32' ? '\\' : $^O eq 'MacOS' ? ':' : '/';
+my $endpathsep = $^O eq 'MacOS' ? ':' : '';
+
sub split_a_file {
my $contents = shift;
my $file = $_[0];
@@ -76,7 +77,10 @@ my $dir = File::Spec->catdir($incdir, 'auto');
if ($^O eq 'VMS') {
$dir = VMS::Filespec::unixify($dir);
$dir =~ s/\/$//;
+} elsif ($^O eq 'MacOS') {
+ $dir =~ s/:$//;
}
+
foreach (@tests) {
my $module = 'A' . $i . '_' . $$ . 'splittest';
my $file = File::Spec->catfile($incdir,"$module.pm");
@@ -84,6 +88,7 @@ foreach (@tests) {
s/\*DIR\*/$dir/gm;
s/\*MOD\*/$module/gm;
s/\*PATHSEP\*/$pathsep/gm;
+ s/\*ENDPATHSEP\*/$endpathsep/gm;
s#//#/#gm;
# Build a hash for this test.
my %args = /^\#\#\ ([^\n]*)\n # Key is on a line starting ##
@@ -142,6 +147,7 @@ foreach (@tests) {
}
}
if ($args{Require}) {
+ $args{Require} =~ s|/|:|gm if $^O eq 'MacOS';
my $com = 'require "' . File::Spec->catfile ('auto', $args{Require}) . '"';
$com =~ s{\\}{/}gm if ($^O eq 'MSWin32');
eval $com;
@@ -221,11 +227,11 @@ sub test_a2 : locked { 1; }
# And that was all it has. You were expected to manually inspect the output
## Get
Warning: AutoSplit had to create top-level *DIR* unexpectedly.
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
*INC**PATHSEP**MOD*.pm: some names are not unique when truncated to 8 characters:
- directory *DIR**PATHSEP**MOD*:
+ directory *DIR**PATHSEP**MOD**ENDPATHSEP*:
testtesttesttest4_1.al, testtesttesttest4_2.al truncate to testtest
- directory *DIR**PATHSEP*Yet*PATHSEP*Another*PATHSEP*AutoSplit:
+ directory *DIR**PATHSEP*Yet*PATHSEP*Another*PATHSEP*AutoSplit*ENDPATHSEP*:
testtesttesttest4_1.al, testtesttesttest4_2.al truncate to testtest
## Files
*DIR*/*MOD*/autosplit.ix
@@ -281,7 +287,7 @@ missing use AutoLoader; (but don't skip)
1;
__END__
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
@@ -296,7 +302,7 @@ __END__
sub obsolete {my $a if 0; return $a++;}
sub gonner {warn "This gonner function should never get called"}
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
@@ -324,7 +330,7 @@ sub ghoul {"wail"};
sub zombie {"You didn't use fire."};
sub flying_pig {"Oink oink flap flap"};
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
@@ -353,7 +359,7 @@ __END__
sub ghost {"bump"};
sub wraith {9};
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
@@ -399,7 +405,7 @@ With the timestamp check make sure that things happen (stuff gets deleted)
## Extra
0, 1, 0
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
diff --git a/lib/Net/Ping/t/110_icmp_inst.t b/lib/Net/Ping/t/110_icmp_inst.t
index 41f8e155e5..b0ee1b74f3 100644
--- a/lib/Net/Ping/t/110_icmp_inst.t
+++ b/lib/Net/Ping/t/110_icmp_inst.t
@@ -21,6 +21,8 @@ if (($> and $^O ne 'VMS')
or ($^O eq 'VMS'
and (`write sys\$output f\$privilege("SYSPRV")` =~ m/FALSE/))) {
skip "icmp ping requires root privileges.", 1;
+} elsif ($^O eq 'MacOS') {
+ skip "icmp protocol not supported.", 1;
} else {
my $p = new Net::Ping "icmp";
ok !!$p;
diff --git a/lib/Net/hostent.t b/lib/Net/hostent.t
index e82cf85a37..9c6fa1318e 100644
--- a/lib/Net/hostent.t
+++ b/lib/Net/hostent.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-use Test::More tests => 7;
+use Test::More;
BEGIN {
require Config; import Config;
@@ -14,8 +14,12 @@ BEGIN {
{
plan skip_all => "Test uses Socket, Socket not built";
}
+ if ($^O eq 'MacOS') {
+ plan skip_all => "Test relies on resolution of localhost, fails on Mac OS";
+ }
}
+use Test::More tests => 7;
BEGIN { use_ok 'Net::hostent' }
diff --git a/lib/Pod/t/Usage.t b/lib/Pod/t/Usage.t
index f5c7207b8c..d970d9172c 100644
--- a/lib/Pod/t/Usage.t
+++ b/lib/Pod/t/Usage.t
@@ -47,7 +47,8 @@ SKIP: {
is( $$fake_out, $vbl_0, '-pathlist parameter' );
}
-{ # Test exit status from pod2usage()
+SKIP: { # Test exit status from pod2usage()
+ skip "Exit status broken on Mac OS", 1 if $^O eq 'MacOS';
my $exit = ($^O eq 'VMS' ? 2 : 42);
my $dev_null = File::Spec->devnull;
my $args = join ", ", (
diff --git a/lib/Pod/t/pod2html-lib.pl b/lib/Pod/t/pod2html-lib.pl
index 3a83bd14d8..3f1b267ee1 100644
--- a/lib/Pod/t/pod2html-lib.pl
+++ b/lib/Pod/t/pod2html-lib.pl
@@ -7,7 +7,7 @@ sub convert_n_test {
my($podfile, $testname) = @_;
my $cwd = Cwd::cwd();
- my $base_dir = catdir $cwd, "..", "lib", "Pod";
+ my $base_dir = catdir $cwd, updir(), "lib", "Pod";
my $new_dir = catdir $base_dir, "t";
my $infile = catfile $new_dir, "$podfile.pod";
my $outfile = catfile $new_dir, "$podfile.html";
diff --git a/lib/Test/Harness/Straps.pm b/lib/Test/Harness/Straps.pm
index 8f4f6bde48..aff5735667 100644
--- a/lib/Test/Harness/Straps.pm
+++ b/lib/Test/Harness/Straps.pm
@@ -315,8 +315,8 @@ sub _switches {
my $s = '';
$s .= " $ENV{'HARNESS_PERL_SWITCHES'}"
if exists $ENV{'HARNESS_PERL_SWITCHES'};
- $s .= join " ", qq[ "-$1"], map {qq["-I$_"]} $self->_filtered_INC
- if $first =~ /^#!.*\bperl.*\s-\w*([Tt]+)/;
+ $s .= qq[ "-$1" ] if $first =~ /^#!.*\bperl.*\s-\w*([Tt]+)/;
+ $s .= join " ", map {qq["-I$_"]} $self->_filtered_INC;
close(TEST) or print "can't close $file. $!\n";
diff --git a/lib/Test/Harness/t/callback.t b/lib/Test/Harness/t/callback.t
index 2fc943acf3..65de524302 100644
--- a/lib/Test/Harness/t/callback.t
+++ b/lib/Test/Harness/t/callback.t
@@ -10,7 +10,11 @@ BEGIN {
}
}
-my $SAMPLE_TESTS = $ENV{PERL_CORE} ? 'lib/sample-tests' : 't/sample-tests';
+use File::Spec::Functions;
+
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+ ? catdir(curdir(), 'lib', 'sample-tests')
+ : catdir(curdir(), 't', 'sample-tests');
use Test::More;
@@ -49,7 +53,7 @@ $strap->{callback} = sub {
while( my($test, $expect) = each %samples ) {
local @out = ();
- $strap->analyze_file("$SAMPLE_TESTS/$test");
+ $strap->analyze_file(catfile($SAMPLE_TESTS, $test));
is_deeply(\@out, $expect, "$test callback");
}
diff --git a/lib/Test/Harness/t/strap-analyze.t b/lib/Test/Harness/t/strap-analyze.t
index 781ddd2b0b..60ecb0da90 100644
--- a/lib/Test/Harness/t/strap-analyze.t
+++ b/lib/Test/Harness/t/strap-analyze.t
@@ -10,11 +10,19 @@ BEGIN {
}
}
-my $SAMPLE_TESTS = $ENV{PERL_CORE} ? 'lib/sample-tests' : 't/sample-tests';
+use File::Spec::Functions;
+
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+ ? catdir(curdir(), 'lib', 'sample-tests')
+ : catdir(curdir(), 't', 'sample-tests');
use strict;
use Test::More;
+if ($^O eq 'MacOS') {
+ plan skip_all => "Exit status broken on Mac OS";
+}
+
my $IsVMS = $^O eq 'VMS';
# VMS uses native, not POSIX, exit codes.
@@ -417,7 +425,7 @@ while( my($test, $expect) = each %samples ) {
}
my $strap = Test::Harness::Straps->new;
- my %results = $strap->analyze_file("$SAMPLE_TESTS/$test");
+ my %results = $strap->analyze_file(catfile($SAMPLE_TESTS, $test));
is_deeply($results{details}, $expect->{details}, "$test details" );
diff --git a/lib/Test/Harness/t/test-harness.t b/lib/Test/Harness/t/test-harness.t
index 6241818710..d0610596cd 100644
--- a/lib/Test/Harness/t/test-harness.t
+++ b/lib/Test/Harness/t/test-harness.t
@@ -10,7 +10,11 @@ BEGIN {
}
}
-my $SAMPLE_TESTS = $ENV{PERL_CORE} ? "lib/sample-tests" : "t/sample-tests";
+use File::Spec::Functions;
+
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+ ? catdir(curdir(), 'lib', 'sample-tests')
+ : catdir(curdir(), 't', 'sample-tests');
use strict;
@@ -36,9 +40,10 @@ package main;
use Test::More;
my $IsVMS = $^O eq 'VMS';
+my $IsMacOS = $^O eq 'MacOS';
# VMS uses native, not POSIX, exit codes.
-my $die_estat = $IsVMS ? 44 : 1;
+my $die_estat = $IsVMS ? 44 : $IsMacOS ? 0 : 1;
my %samples = (
simple => {
@@ -394,7 +399,7 @@ while (my($test, $expect) = each %samples) {
select NULL; # _run_all_tests() isn't as quiet as it should be.
local $SIG{__WARN__} = sub { $warning .= join '', @_; };
($totals, $failed) =
- Test::Harness::_run_all_tests("$SAMPLE_TESTS/$test");
+ Test::Harness::_run_all_tests(catfile($SAMPLE_TESTS, $test));
};
select STDOUT;
@@ -412,7 +417,7 @@ while (my($test, $expect) = each %samples) {
is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
$expect->{total},
"$test - totals" );
- is_deeply( {map { $_=>$failed->{"$SAMPLE_TESTS/$test"}{$_} }
+ is_deeply( {map { $_=>$failed->{catfile($SAMPLE_TESTS, $test)}{$_} }
keys %{$expect->{failed}}},
$expect->{failed},
"$test - failed" );
diff --git a/lib/Test/Simple/t/exit.t b/lib/Test/Simple/t/exit.t
index 25e6259628..1367bbfdcd 100644
--- a/lib/Test/Simple/t/exit.t
+++ b/lib/Test/Simple/t/exit.t
@@ -18,6 +18,11 @@ if( $^O eq 'VMS' && $] <= 5.00503 ) {
exit 0;
}
+if( $^O eq 'MacOS' ) {
+ print "1..0 # Skip exit status broken on Mac OS\n";
+ exit 0;
+}
+
my $test_num = 1;
# Utility testing functions.
sub ok ($;$) {
diff --git a/lib/Unicode/Collate.pm b/lib/Unicode/Collate.pm
index 676a3aadfe..51c290ec87 100644
--- a/lib/Unicode/Collate.pm
+++ b/lib/Unicode/Collate.pm
@@ -10,6 +10,7 @@ use 5.006;
use strict;
use warnings;
use Carp;
+use File::Spec;
require Exporter;
@@ -151,8 +152,9 @@ sub read_table {
my $self = shift;
my $file = $self->{table} ne '' ? $self->{table} : $KeyFile;
- open my $fk, "<$Path/$file"
- or croak "File does not exist at $Path/$file";
+ my $filepath = File::Spec->catfile($Path, $file);
+ open my $fk, "<$filepath"
+ or croak "File does not exist at $filepath";
while (<$fk>) {
next if /^\s*#/;
diff --git a/lib/Unicode/UCD.t b/lib/Unicode/UCD.t
index 0e1550e289..9082057bbd 100644
--- a/lib/Unicode/UCD.t
+++ b/lib/Unicode/UCD.t
@@ -5,6 +5,7 @@ BEGIN {
}
chdir 't' if -d 't';
@INC = '../lib';
+ @INC = "::lib" if $^O eq 'MacOS'; # module parses @INC itself
}
use strict;
diff --git a/lib/blib.pm b/lib/blib.pm
index 9797f2f229..df20add94c 100644
--- a/lib/blib.pm
+++ b/lib/blib.pm
@@ -34,12 +34,13 @@ Pollutes global name space for development only task.
Nick Ing-Simmons nik@tiuk.ti.com
-=cut
+=cut
use Cwd;
+use File::Spec;
use vars qw($VERSION $Verbose);
-$VERSION = '1.01';
+$VERSION = '1.02';
$Verbose = 0;
sub import
@@ -52,20 +53,32 @@ sub import
$dir = shift;
$dir =~ s/blib\z//;
$dir =~ s,/+\z,,;
- $dir = '.' unless ($dir);
+ $dir = File::Spec->curdir unless ($dir);
die "$dir is not a directory\n" unless (-d $dir);
}
- my $i = 5;
+ my $i = 5;
+ my($blib, $blib_lib, $blib_arch);
while ($i--)
{
- my $blib = "${dir}/blib";
- if (-d $blib && -d "$blib/arch" && -d "$blib/lib")
+ $blib = File::Spec->catdir($dir, "blib");
+ $blib_lib = File::Spec->catdir($blib, "lib");
+
+ if ($^O eq 'MacOS')
+ {
+ $blib_arch = File::Spec->catdir($blib_lib, $MacPerl::Architecture);
+ }
+ else
+ {
+ $blib_arch = File::Spec->catdir($blib, "arch");
+ }
+
+ if (-d $blib && -d $blib_arch && -d $blib_lib)
{
- unshift(@INC,"$blib/arch","$blib/lib");
+ unshift(@INC,$blib_arch,$blib_lib);
warn "Using $blib\n" if $Verbose;
return;
}
- $dir .= "/..";
+ $dir = File::Spec->catdir($dir, File::Spec->updir);
}
die "Cannot find blib even in $dir\n";
}
diff --git a/lib/blib.t b/lib/blib.t
index bb269c443f..6828f8b247 100644
--- a/lib/blib.t
+++ b/lib/blib.t
@@ -6,10 +6,11 @@ BEGIN {
}
use strict;
+my($blib, $blib_arch, $blib_lib, @blib_dirs);
sub _cleanup {
- rmdir foreach reverse qw(blib blib/arch blib/lib);
- unlink "stderr";
+ rmdir foreach reverse (@_);
+ unlink "stderr" unless $^O eq 'MacOS';
}
sub _mkdirs {
@@ -20,14 +21,30 @@ sub _mkdirs {
}
-BEGIN { _cleanup }
+BEGIN {
+ if ($^O eq 'MacOS')
+ {
+ $blib = ":blib:";
+ $blib_lib = ":blib:lib:";
+ $blib_arch = ":blib:lib:$MacPerl::Architecture:";
+ @blib_dirs = ($blib, $blib_lib, $blib_arch); # order
+ }
+ else
+ {
+ $blib = "blib";
+ $blib_arch = "blib/arch";
+ $blib_lib = "blib/lib";
+ @blib_dirs = ($blib, $blib_arch, $blib_lib);
+ }
+ _cleanup( @blib_dirs );
+}
use Test::More tests => 7;
eval 'use blib;';
ok( $@ =~ /Cannot find blib/, 'Fails if blib directory not found' );
-_mkdirs(qw(blib blib/arch blib/lib));
+_mkdirs( @blib_dirs );
{
my $warnings = '';
@@ -39,7 +56,7 @@ _mkdirs(qw(blib blib/arch blib/lib));
is( @INC, 3, '@INC now has 3 elements' );
is( $INC[2], '../lib', 'blib added to the front of @INC' );
-ok( grep(m|blib/lib$|, @INC[0,1]) == 1, ' blib/lib in @INC');
-ok( grep(m|blib/arch$|, @INC[0,1]) == 1, ' blib/arch in @INC');
+ok( grep(m|$blib_lib$|, @INC[0,1]) == 1, ' blib/lib in @INC');
+ok( grep(m|$blib_arch$|, @INC[0,1]) == 1, ' blib/arch in @INC');
-END { _cleanup(); }
+END { _cleanup( @blib_dirs ); }
diff --git a/lib/open.t b/lib/open.t
index 48abf25bb3..7e09d8d687 100644
--- a/lib/open.t
+++ b/lib/open.t
@@ -3,6 +3,7 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
require Config; import Config;
}
diff --git a/lib/strict.t b/lib/strict.t
index f03271b536..02f191b9c5 100644
--- a/lib/strict.t
+++ b/lib/strict.t
@@ -13,12 +13,12 @@ my $Is_MSWin32 = $^O eq 'MSWin32';
my $Is_NetWare = $^O eq 'NetWare';
my $tmpfile = "tmp0000";
my $i = 0 ;
-1 while -f ++$tmpfile;
+1 while -e ++$tmpfile;
END { if ($tmpfile) { 1 while unlink $tmpfile; } }
my @prgs = () ;
-foreach (sort glob($^O eq 'MacOS' ? ":lib::strict:*" : "lib/strict/*")) {
+foreach (sort glob($^O eq 'MacOS' ? ":lib:strict:*" : "lib/strict/*")) {
next if /(~|\.orig|,v)$/;
@@ -65,7 +65,7 @@ for (@prgs){
$prog = shift @files ;
$prog =~ s|\./abc|:abc|g if $^O eq 'MacOS';
}
- open TEST, ">$tmpfile";
+ open TEST, ">$tmpfile" or die "Could not open: $!";
print TEST $prog,"\n";
close TEST or die "Could not close: $!";
my $results = $Is_MSWin32 ?
diff --git a/lib/subs.t b/lib/subs.t
index a98dd1d69e..92f4302730 100644
--- a/lib/subs.t
+++ b/lib/subs.t
@@ -14,9 +14,10 @@ print "1..", scalar @prgs, "\n";
my $Is_VMS = $^O eq 'VMS';
my $Is_MSWin32 = $^O eq 'MSWin32';
my $Is_NetWare = $^O eq 'NetWare';
+my $Is_MacOS = $^O eq 'MacOS';
my $tmpfile = "tmp0000";
my $i = 0 ;
-1 while -f ++$tmpfile;
+1 while -e ++$tmpfile;
END { if ($tmpfile) { 1 while unlink $tmpfile} }
for (@prgs){
diff --git a/lib/warnings.t b/lib/warnings.t
index d6bd3740c0..8e57a6db59 100644
--- a/lib/warnings.t
+++ b/lib/warnings.t
@@ -8,24 +8,32 @@ BEGIN {
}
use File::Path;
+use File::Spec::Functions;
$| = 1;
my $Is_VMS = $^O eq 'VMS';
my $Is_MSWin32 = $^O eq 'MSWin32';
my $Is_NetWare = $^O eq 'NetWare';
+my $Is_MacOS = $^O eq 'MacOS';
my $tmpfile = "tmp0000";
my $i = 0 ;
-1 while -f ++$tmpfile;
+1 while -e ++$tmpfile;
END { if ($tmpfile) { 1 while unlink $tmpfile} }
my @prgs = () ;
my @w_files = () ;
if (@ARGV)
- { print "ARGV = [@ARGV]\n" ; @w_files = map { s#^#./lib/warnings/#; $_ } @ARGV }
+ { print "ARGV = [@ARGV]\n" ;
+ if ($^O eq 'MacOS') {
+ @w_files = map { s#^#:lib:warnings:#; $_ } @ARGV
+ } else {
+ @w_files = map { s#^#./lib/warnings/#; $_ } @ARGV
+ }
+ }
else
- { @w_files = sort glob("lib/warnings/*") }
+ { @w_files = sort glob(catfile(curdir(), "lib", "warnings", "*")) }
my $files = 0;
foreach my $file (@w_files) {
@@ -88,6 +96,13 @@ for (@prgs){
shift @files ;
$prog = shift @files ;
}
+
+ # fix up some paths
+ if ($^O eq 'MacOS') {
+ $prog =~ s|require "./abc(d)?";|require ":abc$1";|g;
+ $prog =~ s|"\."|":"|g;
+ }
+
open TEST, ">$tmpfile" or die "Cannot open >$tmpfile: $!";
print TEST q{
BEGIN {
@@ -123,6 +138,13 @@ for (@prgs){
$results =~ s/^(syntax|parse) error/syntax error/mig;
# allow all tests to run when there are leaks
$results =~ s/Scalars leaked: \d+\n//g;
+
+ # fix up some paths
+ if ($^O eq 'MacOS') {
+ $results =~ s|:abc\.pm\b|abc.pm|g;
+ $results =~ s|:abc(d)?\b|./abc$1|g;
+ }
+
$expected =~ s/\n+$//;
my $prefix = ($results =~ s#^PREFIX(\n|$)##) ;
# any special options? (OPTIONS foo bar zap)