Commit | Line | Data |
---|---|---|
2e173144 CBW |
1 | #!perl |
2 | ||
3 | use 5.008001; | |
4 | ||
5 | use strict; | |
6 | use warnings; | |
406c51ee | 7 | |
302cc833 | 8 | BEGIN { |
162b417c | 9 | if (!eval { require Socket }) { |
5abafd4c | 10 | print "1..0 # no Socket\n"; exit 0; |
1a8dcddb | 11 | } |
162b417c | 12 | if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { |
8b14f033 JH |
13 | print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; |
14 | } | |
302cc833 GB |
15 | } |
16 | ||
406c51ee JH |
17 | use Net::Config; |
18 | use Net::NNTP; | |
19 | use Net::Cmd qw(CMD_REJECT); | |
20 | ||
21 | unless(@{$NetConfig{nntp_hosts}} && $NetConfig{test_hosts}) { | |
22 | print "1..0\n"; | |
23 | exit; | |
24 | } | |
25 | ||
26 | print "1..4\n"; | |
27 | ||
28 | my $i = 1; | |
29 | ||
2e173144 | 30 | my $nntp = Net::NNTP->new(Debug => 0) |
5abafd4c | 31 | or (print("not ok 1\n"), exit); |
406c51ee JH |
32 | |
33 | print "ok 1\n"; | |
34 | ||
2e173144 CBW |
35 | my @grp; |
36 | foreach my $grp (qw(test alt.test control news.announce.newusers)) { | |
406c51ee JH |
37 | @grp = $nntp->group($grp); |
38 | last if @grp; | |
39 | } | |
40 | ||
41 | if($nntp->status == CMD_REJECT) { | |
42 | # Command was rejected, probably because we need authinfo | |
43 | map { print "ok ",$_,"\n" } 2,3,4; | |
44 | exit; | |
45 | } | |
46 | ||
47 | print "not " unless @grp; | |
48 | print "ok 2\n"; | |
49 | ||
50 | ||
51 | if(@grp && $grp[2] > $grp[1]) { | |
52 | $nntp->head($grp[1]) or print "not "; | |
53 | } | |
54 | print "ok 3\n"; | |
55 | ||
56 | if(@grp) { | |
57 | $nntp->quit or print "not "; | |
58 | } | |
59 | print "ok 4\n"; | |
60 |