Re: [PATCH-revised] ext/Win32/t/Unicode.t failures on FAT32 under Cygwin
[p5sagit/p5-mst-13.2.git] / ext / Win32 / t / GetLongPathName.t
1 use strict;
2 use Test;
3 use Win32;
4
5 my @paths = qw(
6     /
7     //
8     .
9     ..
10     c:
11     c:/
12     c:./
13     c:/.
14     c:/..
15     c:./..
16     //./
17     //.
18     //..
19     //./..
20 );
21 push @paths, map { my $x = $_; $x =~ s,/,\\,g; $x } @paths;
22 push @paths, qw(
23     ../\
24     c:.\\../\
25     c:/\..//
26     c://.\/./\
27     \\.\\../\
28     //\..//
29     //.\/./\
30 );
31
32 my $drive = $ENV{SystemDrive};
33 if ($drive) {
34     for (@paths) {
35         s/^c:/$drive/;
36     }
37     push @paths, $ENV{SystemRoot} if $ENV{SystemRoot};
38 }
39 my %expect;
40 @expect{@paths} = map { my $x = $_; $x =~ s,(.[/\\])[/\\]+,$1,g; $x } @paths;
41
42 plan tests => scalar(@paths);
43
44 my $i = 1;
45 for (@paths) {
46     my $got = Win32::GetLongPathName($_);
47     print "# '$_' => expect '$expect{$_}' => got '$got'\n";
48     print "not " unless $expect{$_} eq $got;
49     print "ok $i\n";
50     ++$i;
51 }