Debian lenny version packages
[pkg-perl] / deb-src / liburi-perl / liburi-perl-1.35.dfsg.1 / t / news.t
1 #!perl -w
2
3 print "1..7\n";
4
5 use URI;
6
7 $u = URI->new("news:comp.lang.perl.misc");
8
9 print "not " unless $u->group eq "comp.lang.perl.misc" &&
10                     !defined($u->message) &&
11                     $u->port == 119 &&
12                     $u eq "news:comp.lang.perl.misc";
13 print "ok 1\n";
14
15
16 $u->host("news.online.no");
17 print "not " unless $u->group eq "comp.lang.perl.misc" &&
18                     $u->port == 119 &&
19                     $u eq "news://news.online.no/comp.lang.perl.misc";
20 print "ok 2\n";
21
22 $u->group("no.perl", 1 => 10);
23 print "not " unless $u eq "news://news.online.no/no.perl/1-10";
24 print "ok 3\n";
25
26 @g = $u->group;
27 #print "G: @g\n";
28 print "not " unless @g == 3 && "@g" eq "no.perl 1 10";
29 print "ok 4\n";
30
31 $u->message('42@g.aas.no');
32 #print "$u\n";
33 print "not " unless $u->message eq '42@g.aas.no' &&
34                     !defined($u->group) &&
35                     $u eq 'news://news.online.no/42@g.aas.no';
36 print "ok 5\n";
37
38
39 $u = URI->new("nntp:no.perl");
40 print "not " unless $u->group eq "no.perl" &&
41                     $u->port == 119;
42 print "ok 6\n";
43
44 $u = URI->new("snews://snews.online.no/no.perl");
45
46 print "not " unless $u->group eq "no.perl" &&
47                     $u->host  eq "snews.online.no" &&
48                     $u->port == 563;
49 print "ok 7\n";
50