summaryrefslogtreecommitdiff
path: root/t/news.t
diff options
context:
space:
mode:
Diffstat (limited to 't/news.t')
-rw-r--r--t/news.t51
1 files changed, 51 insertions, 0 deletions
diff --git a/t/news.t b/t/news.t
new file mode 100644
index 0000000..a009a9e
--- /dev/null
+++ b/t/news.t
@@ -0,0 +1,51 @@
+use strict;
+use warnings;
+
+print "1..7\n";
+
+use URI;
+
+my $u = URI->new("news:comp.lang.perl.misc");
+
+print "not " unless $u->group eq "comp.lang.perl.misc" &&
+ !defined($u->message) &&
+ $u->port == 119 &&
+ $u eq "news:comp.lang.perl.misc";
+print "ok 1\n";
+
+
+$u->host("news.online.no");
+print "not " unless $u->group eq "comp.lang.perl.misc" &&
+ $u->port == 119 &&
+ $u eq "news://news.online.no/comp.lang.perl.misc";
+print "ok 2\n";
+
+$u->group("no.perl", 1 => 10);
+print "not " unless $u eq "news://news.online.no/no.perl/1-10";
+print "ok 3\n";
+
+my @g = $u->group;
+#print "G: @g\n";
+print "not " unless @g == 3 && "@g" eq "no.perl 1 10";
+print "ok 4\n";
+
+$u->message('42@g.aas.no');
+#print "$u\n";
+print "not " unless $u->message eq '42@g.aas.no' &&
+ !defined($u->group) &&
+ $u eq 'news://news.online.no/42@g.aas.no';
+print "ok 5\n";
+
+
+$u = URI->new("nntp:no.perl");
+print "not " unless $u->group eq "no.perl" &&
+ $u->port == 119;
+print "ok 6\n";
+
+$u = URI->new("snews://snews.online.no/no.perl");
+
+print "not " unless $u->group eq "no.perl" &&
+ $u->host eq "snews.online.no" &&
+ $u->port == 563;
+print "ok 7\n";
+