summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
authorChris Nandor <pudge@pobox.com>2001-06-11 04:24:28 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-11 12:13:31 +0000
commit6c254d95443e15da5c7456d8ce7c28f915ae00bb (patch)
tree46417fadc73894162a84d8130f83ba22c98d0bc3 /t/lib
parent771df0940fe18ac10a1fb9f22390e99d0aa14d65 (diff)
downloadperl-6c254d95443e15da5c7456d8ce7c28f915ae00bb.tar.gz
[RESEND] [PATCH] Mac OS lib patches for bleadperl
Message-Id: <p05100303b74a66faf625@[10.0.1.177]> p4raw-id: //depot/perl@10511
Diffstat (limited to 't/lib')
-rwxr-xr-xt/lib/filecopy.t72
-rwxr-xr-xt/lib/io_dir.t8
2 files changed, 63 insertions, 17 deletions
diff --git a/t/lib/filecopy.t b/t/lib/filecopy.t
index 8412258a69..44b5827e72 100755
--- a/t/lib/filecopy.t
+++ b/t/lib/filecopy.t
@@ -3,12 +3,13 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ push @INC, "::lib:$MacPerl::Architecture" if $^O eq 'MacOS';
}
$| = 1;
my @pass = (0,1);
-my $tests = 11;
+my $tests = $^O eq 'MacOS' ? 14 : 11;
printf "1..%d\n", $tests * scalar(@pass);
use File::Copy;
@@ -82,22 +83,65 @@ for my $pass (@pass) {
print "# foo=`$foo'\nnot " unless $foo eq sprintf "ok %d\n", 3+$loopconst;
printf "ok %d\n", 9+$loopconst;
- copy "file-$$", "lib";
- open(R, "lib/file-$$") or die; $foo = <R>; close(R);
- print "not " unless $foo eq sprintf "ok %d\n", 3+$loopconst;
- printf "ok %d\n", 10+$loopconst;
- unlink "lib/file-$$" or die "unlink: $!";
-
- move "file-$$", "lib";
- open(R, "lib/file-$$") or die "open lib/file-$$: $!"; $foo = <R>; close(R);
- print "not " unless $foo eq sprintf("ok %d\n", 3+$loopconst)
- and not -e "file-$$";;
- printf "ok %d\n", 11+$loopconst;
- unlink "lib/file-$$" or die "unlink: $!";
+ if ($^O eq 'MacOS') {
+
+ copy "file-$$", "lib";
+ open(R, ":lib:file-$$") or die; $foo = <R>; close(R);
+ print "not " unless $foo eq sprintf "ok %d\n", 3+$loopconst;
+ printf "ok %d\n", 10+$loopconst;
+ unlink ":lib:file-$$" or die "unlink: $!";
+
+ copy "file-$$", ":lib";
+ open(R, ":lib:file-$$") or die; $foo = <R>; close(R);
+ print "not " unless $foo eq sprintf "ok %d\n", 3+$loopconst;
+ printf "ok %d\n", 11+$loopconst;
+ unlink ":lib:file-$$" or die "unlink: $!";
+
+ copy "file-$$", ":lib:";
+ open(R, ":lib:file-$$") or die; $foo = <R>; close(R);
+ print "not " unless $foo eq sprintf "ok %d\n", 3+$loopconst;
+ printf "ok %d\n", 12+$loopconst;
+ unlink ":lib:file-$$" or die "unlink: $!";
+
+ unless (-e 'lib:') { # make sure there's no volume called 'lib'
+ undef $@;
+ eval { (copy "file-$$", "lib:") || die "'lib:' is not a volume name"; };
+ print "# Died: $@";
+ print "not " unless ( $@ =~ m|'lib:' is not a volume name| );
+ }
+ printf "ok %d\n", 13+$loopconst;
+
+ move "file-$$", ":lib:";
+ open(R, ":lib:file-$$") or die "open :lib:file-$$: $!"; $foo = <R>; close(R);
+ print "not " unless $foo eq sprintf("ok %d\n", 3+$loopconst)
+ and not -e "file-$$";;
+ printf "ok %d\n", 14+$loopconst;
+ unlink ":lib:file-$$" or die "unlink: $!";
+
+ } else {
+
+ copy "file-$$", "lib";
+ open(R, "lib/file-$$") or die; $foo = <R>; close(R);
+ print "not " unless $foo eq sprintf "ok %d\n", 3+$loopconst;
+ printf "ok %d\n", 10+$loopconst;
+ unlink "lib/file-$$" or die "unlink: $!";
+
+ move "file-$$", "lib";
+ open(R, "lib/file-$$") or die "open lib/file-$$: $!"; $foo = <R>; close(R);
+ print "not " unless $foo eq sprintf("ok %d\n", 3+$loopconst)
+ and not -e "file-$$";;
+ printf "ok %d\n", 11+$loopconst;
+ unlink "lib/file-$$" or die "unlink: $!";
+
+ }
}
END {
1 while unlink "file-$$";
- 1 while unlink "lib/file-$$";
+ if ($^O eq 'MacOS') {
+ 1 while unlink ":lib:file-$$";
+ } else {
+ 1 while unlink "lib/file-$$";
+ }
}
diff --git a/t/lib/io_dir.t b/t/lib/io_dir.t
index 3689871555..6ec4e9f232 100755
--- a/t/lib/io_dir.t
+++ b/t/lib/io_dir.t
@@ -19,7 +19,9 @@ use IO::Dir qw(DIR_UNLINK);
print "1..10\n";
-$dot = new IO::Dir ".";
+my $DIR = $^O eq 'MacOS' ? ":" : ".";
+
+$dot = new IO::Dir $DIR;
print defined($dot) ? "ok" : "not ok", " 1\n";
@a = sort <*>;
@@ -41,7 +43,7 @@ open(FH,'>X') || die "Can't create x";
print FH "X";
close(FH);
-tie %dir, IO::Dir, ".";
+tie %dir, IO::Dir, $DIR;
my @files = keys %dir;
# I hope we do not have an empty dir :-)
@@ -55,7 +57,7 @@ delete $dir{'X'};
print -f 'X' ? "ok" : "not ok", " 8\n";
-tie %dirx, IO::Dir, ".", DIR_UNLINK;
+tie %dirx, IO::Dir, $DIR, DIR_UNLINK;
my $statx = $dirx{'X'};
print defined($statx) && UNIVERSAL::isa($statx,'File::stat') && $statx->size == 1