This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate perlio:
[perl5.git] / t / win32 / longpath.t
CommitLineData
bb27e7b6
JH
1#!perl -w
2
3# tests for Win32::GetLongPathName()
4
5$^O =~ /^MSWin/ or print("1..0 # not win32\n" ), exit;
6
7my @paths = qw(
8 /
9 //
10 .
11 ..
12 c:
13 c:/
14 c:./
15 c:/.
16 c:/..
17 c:./..
18 //./
19 //.
20 //..
21 //./..
22);
23push @paths, map { my $x = $_; $x =~ s,/,\\,g; $x } @paths;
24push @paths, qw(
25 ../\
26 c:.\\../\
27 c:/\..//
28 c://.\/./\
29 \\.\\../\
30 //\..//
31 //.\/./\
32);
33
34my $drive = $ENV{SystemDrive};
35if ($drive) {
36 for (@paths) {
37 s/^c:/$drive/;
38 }
39 push @paths, $ENV{SystemRoot} if $ENV{SystemRoot};
40}
41my %expect;
42@expect{@paths} = map { my $x = $_; $x =~ s,(.[/\\])[/\\]+,$1,g; $x } @paths;
43
44print "1.." . @paths . "\n";
45my $i = 1;
46for (@paths) {
47 my $got = Win32::GetLongPathName($_);
48 print "# '$_' => expect '$expect{$_}' => got '$got'\n";
49 print "not " unless $expect{$_} eq $got;
50 print "ok $i\n";
51 ++$i;
52}