This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
File-Path: sync in CPAN version 2.17
[perl5.git] / cpan / 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 }
38 my %expect;
39 @expect{@paths} = map { my $x = $_;
40                         $x =~ s,(.[/\\])[/\\]+,$1,g;
41                         $x =~ s,^(\w):,\U$1:,;
42                         $x } @paths;
43
44 plan tests => scalar(@paths);
45
46 my $i = 1;
47 for (@paths) {
48     my $got = Win32::GetLongPathName($_);
49     print "# '$_' => expect '$expect{$_}' => got '$got'\n";
50     print "not " unless $expect{$_} eq $got;
51     print "ok $i\n";
52     ++$i;
53 }