summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2007-05-22 09:35:27 -0700
committerSteve Hay <SteveHay@planit.com>2007-05-23 08:12:14 +0000
commitd3ca1033876070b408cb1dc6a61c430a43cfd7c0 (patch)
tree848a641dfcdcfd53cef79121c6c80c322010bb33 /ext
parent7558f805261d86f66deccfa1e478406a0bb1a1ac (diff)
downloadperl-d3ca1033876070b408cb1dc6a61c430a43cfd7c0.tar.gz
RE: [PATCH] Skip ext/Win32/t/Unicode.t under Cygwin
From: "Jan Dubois" <jand@activestate.com> Message-ID: <06dd01c79cc9$e101ce60$a3056b20$@com> Reinstates the test under Cygwin and fixes it. p4raw-id: //depot/perl@31259
Diffstat (limited to 'ext')
-rw-r--r--ext/Win32/t/Unicode.t22
1 files changed, 14 insertions, 8 deletions
diff --git a/ext/Win32/t/Unicode.t b/ext/Win32/t/Unicode.t
index 8a435f953d..f8f03b845d 100644
--- a/ext/Win32/t/Unicode.t
+++ b/ext/Win32/t/Unicode.t
@@ -1,14 +1,10 @@
use strict;
use Test;
-use Win32;
use Cwd qw(cwd);
+use Win32;
BEGIN {
- if ($^O eq 'cygwin') {
- print "1..0 # Skip: Cygwin doesn't support Unicode filenames\n";
- exit 0;
- }
unless (defined &Win32::BuildNumber && Win32::BuildNumber() >= 820 or $] >= 5.008009) {
print "1..0 # Skip: Needs ActivePerl 820 or Perl 5.8.9 or later\n";
exit 0;
@@ -24,6 +20,7 @@ BEGIN {
}
my $home = Win32::GetCwd();
+my $cwd = cwd(); # may be a Cygwin path
my $dir = "Foo \x{394}\x{419} Bar \x{5E7}\x{645} Baz";
my $file = "$dir\\xyzzy \x{394}\x{419} plugh \x{5E7}\x{645}";
@@ -67,13 +64,22 @@ ok(Win32::SetCwd($dir));
ok(Win32::GetLongPathName(Win32::GetCwd()), $long);
# cwd() also returns a usable ANSI directory name
-(my $cwd = cwd) =~ s,/,\\,g;
-ok(Win32::GetLongPathName($cwd), $long);
+my $subdir = cwd();
-# change back to home directory
+# change back to home directory to make sure relative paths
+# in @INC continue to work
ok(chdir($home));
ok(Win32::GetCwd(), $home);
+# cwd() on Cygwin returns a mapped path that we need to translate
+# back to a Windows path. Invoking `cygpath` on $subdir doesn't work.
+if ($^O eq "cygwin") {
+ chomp(my $cygpath = `cygpath -w "$cwd"`);
+ $subdir =~ s,\Q$cwd\E,$cygpath,;
+}
+$subdir =~ s,/,\\,g;
+ok(Win32::GetLongPathName($subdir), $long);
+
# We can chdir() into the Unicode directory if we use the ANSI name
ok(chdir(Win32::GetANSIPathName($dir)));
ok(Win32::GetLongPathName(Win32::GetCwd()), $long);