summaryrefslogtreecommitdiff
path: root/ext/Cwd
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-10 16:16:00 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-10 16:16:00 +0000
commitea0672253453b958f0828f9b0ae963e7fb211e00 (patch)
tree165c225d39f9c9b5efb30224e5c5c5ea3248d18d /ext/Cwd
parentb4dc1df62bdad80806c00c64d3bd6d5f79c36f63 (diff)
downloadperl-ea0672253453b958f0828f9b0ae963e7fb211e00.tar.gz
Upgrade to Cwd 2.17.
p4raw-id: //depot/perl@22482
Diffstat (limited to 'ext/Cwd')
-rw-r--r--ext/Cwd/Changes6
-rw-r--r--ext/Cwd/t/cwd.t29
2 files changed, 28 insertions, 7 deletions
diff --git a/ext/Cwd/Changes b/ext/Cwd/Changes
index c3158baeac..ca9684e367 100644
--- a/ext/Cwd/Changes
+++ b/ext/Cwd/Changes
@@ -1,5 +1,11 @@
Revision history for Perl extension Cwd.
+2.17 Wed Mar 10 07:55:36 CST 2004
+
+ - The change in 2.16 created a testing failure when tested from
+ within a path that contains symlinks (for instance, /tmp ->
+ /private/tmp).
+
2.16 Sat Mar 6 17:56:31 CST 2004
- For VMS compatibility (and to conform to Cwd's documented
diff --git a/ext/Cwd/t/cwd.t b/ext/Cwd/t/cwd.t
index fbd8133cd9..c2142e99f4 100644
--- a/ext/Cwd/t/cwd.t
+++ b/ext/Cwd/t/cwd.t
@@ -89,9 +89,8 @@ SKIP: {
}
}
-my $Top_Test_Dir = '_ptrslt_';
-my $Test_Dir = File::Spec->catdir($Top_Test_Dir, qw/_path_ _to_ _a_ _dir_/);
-my $want = quotemeta File::Spec->rel2abs($Test_Dir);
+my @test_dirs = qw{_ptrslt_ _path_ _to_ _a_ _dir_};
+my $Test_Dir = File::Spec->catdir(@test_dirs);
mkpath([$Test_Dir], 0, 0777);
Cwd::chdir $Test_Dir;
@@ -99,11 +98,11 @@ Cwd::chdir $Test_Dir;
foreach my $func (qw(cwd getcwd fastcwd fastgetcwd)) {
my $result = eval "$func()";
is $@, '';
- like( File::Spec->canonpath($result), qr|$want$|i, "$func()" );
+ dir_ends_with( $result, $Test_Dir, "$func()" );
}
# Cwd::chdir should also update $ENV{PWD}
-like(File::Spec->canonpath($ENV{PWD}), qr|$want$|i, 'Cwd::chdir() updates $ENV{PWD}');
+dir_ends_with( $ENV{PWD}, $Test_Dir, 'Cwd::chdir() updates $ENV{PWD}' );
my $updir = File::Spec->updir;
Cwd::chdir $updir;
print "#$ENV{PWD}\n";
@@ -116,7 +115,7 @@ print "#$ENV{PWD}\n";
Cwd::chdir $updir;
print "#$ENV{PWD}\n";
-rmtree([$Top_Test_Dir], 0, 0);
+rmtree($test_dirs[0], 0, 0);
{
my $check = ($IsVMS ? qr|\b((?i)t)\]$| :
@@ -139,6 +138,22 @@ SKIP: {
like($abs_path, qr|$want$|);
like($fast_abs_path, qr|$want$|);
- rmtree([$Top_Test_Dir], 0, 0);
+ rmtree($test_dirs[0], 0, 0);
unlink "linktest";
}
+
+#############################################
+# These two routines give us sort of a poor-man's cross-platform
+# directory comparison routine.
+
+sub bracketed_form {
+ return join '', map "[$_]",
+ grep length, File::Spec->splitdir(File::Spec->canonpath( shift() ));
+}
+
+sub dir_ends_with {
+ my ($dir, $expect) = (shift, shift);
+ my $bracketed_expect = quotemeta bracketed_form($expect);
+ like( bracketed_form($dir), qr|$bracketed_expect$|i, (@_ ? shift : ()) );
+}
+