This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test fixes to go along with longpath.inc patch
[perl5.git] / ext / Win32 / t / GetLongPathName.t
CommitLineData
83a611dd
JD
1use strict;
2use Test;
3use Win32;
bb27e7b6
JH
4
5my @paths = qw(
6 /
7 //
8 .
9 ..
10 c:
11 c:/
12 c:./
13 c:/.
14 c:/..
15 c:./..
16 //./
17 //.
18 //..
19 //./..
20);
21push @paths, map { my $x = $_; $x =~ s,/,\\,g; $x } @paths;
22push @paths, qw(
23 ../\
24 c:.\\../\
25 c:/\..//
26 c://.\/./\
27 \\.\\../\
28 //\..//
29 //.\/./\
30);
31
32my $drive = $ENV{SystemDrive};
33if ($drive) {
34 for (@paths) {
35 s/^c:/$drive/;
36 }
37 push @paths, $ENV{SystemRoot} if $ENV{SystemRoot};
38}
39my %expect;
7fdd88d4
JH
40@expect{@paths} = map { my $x = $_;
41 $x =~ s,(.[/\\])[/\\]+,$1,g;
42 $x =~ s,^c,C,;
43 $x } @paths;
bb27e7b6 44
83a611dd
JD
45plan tests => scalar(@paths);
46
bb27e7b6
JH
47my $i = 1;
48for (@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}