]> pd.if.org Git - newsd/commitdiff
Added SKIP block for useless follow up tests.
authorNathan Wagner <nw@hydaspes.if.org>
Tue, 25 Sep 2012 12:48:36 +0000 (12:48 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Tue, 25 Sep 2012 12:48:36 +0000 (12:48 +0000)
t/02_capabilities.t
t/03_responses.t

index 33b80b009dd318c60e8ee770f7b0b7c18c9837e2..644a8dc915578c726371a3c5425e530524230ba2 100644 (file)
@@ -58,12 +58,12 @@ SKIP: {
        ok($twice == 0, 'No capability listed twice (3977:5.2.2)');
        ok(exists $cap{READER}, 'announce READER');
        is($cap{'MODE-READER'}, undef, q{don't announce MODE-READER});
-       foreach $trycap qw(ACTIVE NEWSGROUPS OVERVIEW.FMT
-               ACTIVE.TIMES HEADERS) {
+       foreach $trycap (qw(ACTIVE NEWSGROUPS OVERVIEW.FMT
+               ACTIVE.TIMES HEADERS)) {
                cmp_ok(scalar(grep { $trycap eq $_ } @{$cap{LIST}}), '==', 1,
                        "list capability $trycap");
        }
-       foreach $trycap qw(MSGID) {
+       foreach $trycap (qw(MSGID)) {
                cmp_ok(scalar(grep { $trycap eq $_ } @{$cap{OVER}}), '==', 1,
                        "list capability $trycap");
        }
index 0ff39d2ceda135f050171bd058c7cf18f498cc7d..0e3fd4ffc70efbcc56fef969d9d7a7f2b3329f46 100644 (file)
@@ -26,6 +26,17 @@ sub Net::NNTP::try {
        return $c->code;
 }
 
+sub Net::NNTP::must {
+       my ($c, $cmd, $test, @valid) = @_;
+       $c->command($cmd);
+       $c->response();
+       ok(scalar (grep {$c->code == $_} @valid) , "$test ".$c->code." in (@valid)");
+       if (scalar (grep {$c->code == $_} @valid)) {
+               return $c->code;
+       }
+       die $c->code;
+}
+
 # 3977:5.1.1 initial greeting must be 200 201 400 502
 my @valid = (200, 201, 400, 502);
 my $greeting = $c->code;
@@ -39,8 +50,14 @@ unless ($greeting == 200 or $greeting = 201) {
 # 4 tests done to here
 
 $c->try('STAT','stat with no newsgroup',412);
-$c->try('GROUP de.test','group selection',211);
-$c->try('STAT','stat with newsgroup',223,420);
+
+eval {
+       $c->must('GROUP de.test','group selection',211);
+};
+SKIP: {
+       skip "group failed, can't stat", 1 if $@;
+       $c->try('STAT','stat with newsgroup',223,420);
+}
 
 goto quit;