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