Just sorting to guarantee order is not enough.
[p5sagit/p5-mst-13.2.git] / lib / Net / t / nntp.t
CommitLineData
406c51ee 1#!./perl -w
2
302cc833 3BEGIN {
4 unless (-d 'blib') {
5 chdir 't' if -d 't';
6 @INC = '../lib';
7 }
8}
9
406c51ee 10use Net::Config;
11use Net::NNTP;
12use Net::Cmd qw(CMD_REJECT);
13
14unless(@{$NetConfig{nntp_hosts}} && $NetConfig{test_hosts}) {
15 print "1..0\n";
16 exit;
17}
18
19print "1..4\n";
20
21my $i = 1;
22
23$nntp = Net::NNTP->new(Debug => 0)
24 or (print("not ok 1\n"), exit);
25
26print "ok 1\n";
27
28my $grp;
29foreach $grp (qw(test alt.test control news.announce.newusers)) {
30 @grp = $nntp->group($grp);
31 last if @grp;
32}
33
34if($nntp->status == CMD_REJECT) {
35 # Command was rejected, probably because we need authinfo
36 map { print "ok ",$_,"\n" } 2,3,4;
37 exit;
38}
39
40print "not " unless @grp;
41print "ok 2\n";
42
43
44if(@grp && $grp[2] > $grp[1]) {
45 $nntp->head($grp[1]) or print "not ";
46}
47print "ok 3\n";
48
49if(@grp) {
50 $nntp->quit or print "not ";
51}
52print "ok 4\n";
53