summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-28 18:42:05 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-28 18:42:05 +0000
commitd19fbd04076ae880af8ebed3883160a9bad39a03 (patch)
tree37f5250c9350748564511a229e454641f95ff746 /t
parentc20d13f2caa46b7d6786d1f321e0563325149414 (diff)
downloadperl-d19fbd04076ae880af8ebed3883160a9bad39a03.tar.gz
Can't trust external pwds
(either shell builtins or external programs) p4raw-id: //depot/perl@9419
Diffstat (limited to 't')
-rw-r--r--t/lib/cwd.t40
1 files changed, 11 insertions, 29 deletions
diff --git a/t/lib/cwd.t b/t/lib/cwd.t
index adc57f6efb..f9cdffbd0f 100644
--- a/t/lib/cwd.t
+++ b/t/lib/cwd.t
@@ -10,7 +10,7 @@ use Cwd;
use strict;
use warnings;
-print "1..14\n";
+print "1..10\n";
# check imports
print +(defined(&cwd) &&
@@ -23,24 +23,6 @@ print +(!defined(&chdir) &&
!defined(&fast_abs_path) ?
"" : "not "), "ok 2\n";
-# XXX these tests rely on a working pwd program or shell command
-chomp(my $start = `pwd 2>/dev/null`);
-if ($?) {
- print "ok 3 # skipped\n";
- print "ok 4 # skipped\n";
- print "ok 5 # skipped\n";
- print "ok 6 # skipped\n";
-} else {
- my $cwd = cwd;
- my $getcwd = getcwd;
- my $fastcwd = fastcwd;
- my $fastgetcwd = fastgetcwd;
- print +($cwd eq $start ? "" : "not "), "ok 3\n";
- print +($getcwd eq $start ? "" : "not "), "ok 4\n";
- print +($fastcwd eq $start ? "" : "not "), "ok 5\n";
- print +($fastgetcwd eq $start ? "" : "not "), "ok 6\n";
-}
-
mkdir "pteerslt", 0777;
mkdir "pteerslt/path", 0777;
mkdir "pteerslt/path/to", 0777;
@@ -52,19 +34,19 @@ my $getcwd = getcwd;
my $fastcwd = fastcwd;
my $fastgetcwd = fastgetcwd;
my $want = "t/pteerslt/path/to/a/dir";
-print +($cwd =~ m|$want$| ? "" : "not "), "ok 7\n";
-print +($getcwd =~ m|$want$| ? "" : "not "), "ok 8\n";
-print +($fastcwd =~ m|$want$| ? "" : "not "), "ok 9\n";
-print +($fastgetcwd =~ m|$want$| ? "" : "not "), "ok 10\n";
+print +($cwd =~ m|$want$| ? "" : "not "), "ok 3\n";
+print +($getcwd =~ m|$want$| ? "" : "not "), "ok 4\n";
+print +($fastcwd =~ m|$want$| ? "" : "not "), "ok 5\n";
+print +($fastgetcwd =~ m|$want$| ? "" : "not "), "ok 6\n";
# Cwd::chdir should also update $ENV{PWD}
-print +($ENV{PWD} =~ m|$want$| ? "" : "not "), "ok 11\n";
+print +($ENV{PWD} =~ m|$want$| ? "" : "not "), "ok 7\n";
Cwd::chdir ".."; rmdir "dir";
Cwd::chdir ".."; rmdir "a";
Cwd::chdir ".."; rmdir "to";
Cwd::chdir ".."; rmdir "path";
Cwd::chdir ".."; rmdir "pteerslt";
-print +($ENV{PWD} =~ m|\bt$| ? "" : "not "), "ok 12\n";
+print +($ENV{PWD} =~ m|\bt$| ? "" : "not "), "ok 8\n";
if ($Config{d_symlink}) {
my @dirs = split " " => $Config{libpth};
@@ -76,13 +58,13 @@ if ($Config{d_symlink}) {
my $abs_path = Cwd::abs_path($rel);
my $fast_abs_path = Cwd::fast_abs_path($rel);
- print +($abs_path eq $target ? "" : "not "), "ok 13\n";
- print +($fast_abs_path eq $target ? "" : "not "), "ok 14\n";
+ print +($abs_path eq $target ? "" : "not "), "ok 9\n";
+ print +($fast_abs_path eq $target ? "" : "not "), "ok 10\n";
chdir "..";
rmdir "pteerslt";
unlink "linktest";
} else {
- print "ok 13 # skipped\n";
- print "ok 14 # skipped\n";
+ print "ok 9 # Skip: no symlink\n";
+ print "ok 10 # Skip: no symlink\n";
}