[6565f5]: perl / pl-CYG10-95f6fab9_skip_testing_cygwin_utf8_readdir_with_Win32_ANSI_API.patch  Maximize  Restore  History

Download this file

184 lines (182 with data), 5.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
From: Reini Urban <rurban@x-ray.at>
Subject: [PATCH] skip testing cygwin utf8 readdir() with Win32 ANSI API
Author: Reini Urban <rurban@x-ray.at>
Date: Tue Apr 12 12:29:30 2011 +0200
diff --git a/cpan/Win32/t/Unicode.t b/cpan/Win32/t/Unicode.t
index 3570142..154372b 100644
--- a/cpan/Win32/t/Unicode.t
+++ b/cpan/Win32/t/Unicode.t
@@ -1,85 +1,88 @@
-use strict;
-use Test;
-use Cwd qw(cwd);
-use Win32;
-
-BEGIN {
- 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;
- }
- if ((((Win32::FsType())[1] & 4) == 0) || (Win32::FsType() =~ /^FAT/)) {
- print "1..0 # Skip: Filesystem doesn't support Unicode\n";
- exit 0;
- }
- unless ((Win32::GetOSVersion())[1] > 4) {
- print "1..0 # Skip: Unicode support requires Windows 2000 or later\n";
- exit 0;
- }
-}
-
-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}";
-
-sub cleanup {
- chdir($home);
- my $ansi = Win32::GetANSIPathName($file);
- unlink($ansi) if -f $ansi;
- $ansi = Win32::GetANSIPathName($dir);
- rmdir($ansi) if -d $ansi;
-}
-
-cleanup();
-END { cleanup() }
-
-plan test => 12;
-
-# Create Unicode directory
-Win32::CreateDirectory($dir);
-ok(-d Win32::GetANSIPathName($dir));
-
-# Create Unicode file
-Win32::CreateFile($file);
-ok(-f Win32::GetANSIPathName($file));
-
-# readdir() returns ANSI form of Unicode filename
-ok(opendir(my $dh, Win32::GetANSIPathName($dir)));
-while ($_ = readdir($dh)) {
- next if /^\./;
- ok($file, Win32::GetLongPathName("$dir\\$_"));
-}
-closedir($dh);
-
-# Win32::GetLongPathName() of the absolute path restores the Unicode dir name
-my $full = Win32::GetFullPathName($dir);
-my $long = Win32::GetLongPathName($full);
-
-ok($long, Win32::GetLongPathName($home)."\\$dir");
-
-# We can Win32::SetCwd() into the Unicode directory
-ok(Win32::SetCwd($dir));
-
-my $w32dir = Win32::GetCwd();
-# cwd() also returns a usable ANSI directory name
-my $subdir = cwd();
-
-# change back to home directory to make sure relative paths
-# in @INC continue to work
-ok(chdir($home));
-ok(Win32::GetCwd(), $home);
-
-ok(Win32::GetLongPathName($w32dir), $long);
-
-# 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") {
- $subdir = Cygwin::posix_to_win_path($subdir, 1);
-}
-$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);
+use strict;
+use Test;
+use Cwd qw(cwd);
+use Config qw(%Config);
+use Win32;
+
+BEGIN {
+ 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;
+ }
+ if ((((Win32::FsType())[1] & 4) == 0) || (Win32::FsType() =~ /^FAT/)) {
+ print "1..0 # Skip: Filesystem doesn't support Unicode\n";
+ exit 0;
+ }
+ unless ((Win32::GetOSVersion())[1] > 4) {
+ print "1..0 # Skip: Unicode support requires Windows 2000 or later\n";
+ exit 0;
+ }
+}
+
+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}";
+
+sub cleanup {
+ chdir($home);
+ my $ansi = Win32::GetANSIPathName($file);
+ unlink($ansi) if -f $ansi;
+ $ansi = Win32::GetANSIPathName($dir);
+ rmdir($ansi) if -d $ansi;
+}
+
+cleanup();
+END { cleanup() }
+
+plan test => 12;
+
+# Create Unicode directory
+Win32::CreateDirectory($dir);
+ok(-d Win32::GetANSIPathName($dir));
+
+# Create Unicode file
+Win32::CreateFile($file);
+ok(-f Win32::GetANSIPathName($file));
+
+# readdir() returns ANSI form of Unicode filename
+# but on cygwin-1.7 the utf-8 form.
+ok(opendir(my $dh, Win32::GetANSIPathName($dir)));
+while ($_ = readdir($dh)) {
+ next if /^\./;
+ skip($^O eq 'cygwin' and $Config{osvers} ge "1.7" ? "do not test cygwin utf8 readdir()" : 0,
+ $file, Win32::GetLongPathName("$dir\\$_"));
+}
+closedir($dh);
+
+# Win32::GetLongPathName() of the absolute path restores the Unicode dir name
+my $full = Win32::GetFullPathName($dir);
+my $long = Win32::GetLongPathName($full);
+
+ok($long, Win32::GetLongPathName($home)."\\$dir");
+
+# We can Win32::SetCwd() into the Unicode directory
+ok(Win32::SetCwd($dir));
+
+my $w32dir = Win32::GetCwd();
+# cwd() also returns a usable ANSI directory name
+my $subdir = cwd();
+
+# change back to home directory to make sure relative paths
+# in @INC continue to work
+ok(chdir($home));
+ok(Win32::GetCwd(), $home);
+
+ok(Win32::GetLongPathName($w32dir), $long);
+
+# 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") {
+ $subdir = Cygwin::posix_to_win_path($subdir, 1);
+}
+$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);