Debian lenny version packages
[pkg-perl] / deb-src / liburi-perl / liburi-perl-1.35.dfsg.1 / t / rfc2732.t
1 #!perl -w
2
3 print "1..9\n";
4
5 use strict;
6 use URI;
7 my $uri = URI->new("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html");
8
9 print "not " unless $uri->as_string eq "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html";
10 print "ok 1\n";
11
12 print "not " unless $uri->host eq "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]";
13 print "ok 2\n";
14
15 print "not " unless $uri->host_port eq "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80";
16 print "ok 3\n";
17
18 print "not " unless $uri->port eq "80";
19 print "ok 4\n";
20
21 $uri->host("host");
22 print "not " unless $uri->as_string eq "http://host:80/index.html";
23 print "ok 5\n";
24
25 $uri = URI->new("ftp://ftp:@[3ffe:2a00:100:7031::1]");
26 print "not " unless $uri->as_string eq "ftp://ftp:@[3ffe:2a00:100:7031::1]";
27 print "ok 6\n";
28
29 print "not " unless $uri->port eq "21" && !$uri->_port;
30 print "ok 7\n";
31
32 print "not " unless $uri->host("ftp") eq "[3ffe:2a00:100:7031::1]";
33 print "ok 8\n";
34
35 print "not " unless $uri eq "ftp://ftp:\@ftp";
36 print "ok 9\n";
37
38 __END__
39
40       http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
41       http://[1080:0:0:0:8:800:200C:417A]/index.html
42       http://[3ffe:2a00:100:7031::1]
43       http://[1080::8:800:200C:417A]/foo
44       http://[::192.9.5.5]/ipng
45       http://[::FFFF:129.144.52.38]:80/index.html
46       http://[2010:836B:4179::836B:4179]