4 $URI::file::DEFAULT_AUTHORITY = undef;
7 [ "file", "unix", "win32", "mac" ],
8 #---------------- ------------ --------------- --------------
9 [ "file://localhost/foo/bar",
10 "!/foo/bar", "!\\foo\\bar", "!foo:bar", ],
12 "!/foo/bar", "!\\foo\\bar", "!foo:bar", ],
13 [ "file:/foo/bar", "/foo/bar", "\\foo\\bar", "foo:bar", ],
14 [ "foo/bar", "foo/bar", "foo\\bar", ":foo:bar",],
15 [ "file://foo/bar","!//foo/bar", "\\\\foo\\bar", "!foo:bar"],
16 [ "file://a:/", "!//a:/", "!A:\\", undef],
17 [ "file:/", "/", "\\", undef],
18 [ "file://A:relative/", "!//A:relative/", "A:", undef],
19 [ ".", ".", ".", ":"],
20 [ "..", "..", "..", "::"],
21 [ "%2E", "!.", "!.", ":."],
22 [ "../%2E%2E", "!../..", "!..\\..", "::.."],
26 [ "../..", "../..", "..\\..", ":::"],
27 [ "../../", "../../", "..\\..\\", "!:::"],
28 [ "file:./foo.bar", "!./foo.bar", "!.\\foo.bar", "!:foo.bar"],
29 [ "file:/%2Ffoo/bar", undef, undef, "/foo:bar"],
30 [ "file:/.%2Ffoo/bar", undef, undef, "./foo:bar"],
31 [ "file:/fee/.%2Ffoo%2Fbar", undef, undef, "fee:./foo/bar"],
32 [ "file:/.%2Ffoo%2Fbar/", undef, undef, "./foo/bar:"],
33 [ "file:/.%2Ffoo%2Fbar", undef, undef, "!./foo/bar:"],
34 [ "file:/%2E%2E/foo", "!/../foo", "!\\..\\foo" , "..:foo"],
35 [ "file:/bar/%2E/foo", "!/bar/./foo", "!\\bar\\.\\foo", "bar:.:foo"],
36 [ "file:/foo/../bar", "/foo/../bar", "\\foo\\..\\bar", "foo::bar"],
37 [ "file:/a/b/../../c/d", "/a/b/../../c/d", "\\a\\b\\..\\..\\c\\d", "a:b:::c:d"],
39 push(@tests,@extratests);
42 @os = @{shift @tests};
55 my $u = URI->new($file, "file");
58 my $f = $u->file($os);
60 $f = "<undef>" unless defined $f;
61 $expect = "<undef>" unless defined $expect;
63 $loose++ if $expect =~ s/^!//;
65 print "URI->new('$file', 'file')->file('$os') ne $expect, but $f\n";
68 if (defined($t[$i]) && !$loose) {
69 $u2 = URI::file->new($t[$i], $os);
70 unless ($u2->as_string eq $file) {
71 print "URI::file->new('$t[$i]', '$os') ne $file, but $u2\n";