Commit | Line | Data |
83a611dd |
1 | use strict; |
2 | use Test; |
3 | use Win32; |
bb27e7b6 |
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; |
7fdd88d4 |
40 | @expect{@paths} = map { my $x = $_; |
41 | $x =~ s,(.[/\\])[/\\]+,$1,g; |
42 | $x =~ s,^c,C,; |
43 | $x } @paths; |
bb27e7b6 |
44 | |
83a611dd |
45 | plan tests => scalar(@paths); |
46 | |
bb27e7b6 |
47 | my $i = 1; |
48 | for (@paths) { |
49 | my $got = Win32::GetLongPathName($_); |
50 | print "# '$_' => expect '$expect{$_}' => got '$got'\n"; |
51 | print "not " unless $expect{$_} eq $got; |
52 | print "ok $i\n"; |
53 | ++$i; |
54 | } |