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