]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/nntpd*.t: skip TLS tests for old Net::NNTP
authorEric Wong <e@80x24.org>
Sun, 30 Jun 2019 00:01:55 +0000 (00:01 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 Jun 2019 00:01:55 +0000 (00:01 +0000)
Perl prior to 5.22 did not bundle a Net::NNTP (or libnet)
capable of handling TLS.

t/nntpd-tls.t
t/nntpd.t

index 427d370fc4a69a87b7e7f747cbcc5f21bccd1119..e3ecdd4fa0ecd4d83c4122b17ab31ff17a5e0afe 100644 (file)
@@ -11,6 +11,9 @@ foreach my $mod (qw(DBD::SQLite IO::Socket::SSL Net::NNTP IO::Poll)) {
        eval "require $mod";
        plan skip_all => "$mod missing for $0" if $@;
 }
+Net::NNTP->can('starttls') or
+       plan skip_all => 'Net::NNTP does not support TLS';
+
 my $cert = 'certs/server-cert.pem';
 my $key = 'certs/server-key.pem';
 unless (-r $key && -r $cert) {
index 6cba2be435089207d7ad8a33d76b23f11d417461..bf5bb883f728dcb8f500ff67b831962e8b40c174 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -106,8 +106,13 @@ EOF
        is_deeply($list, { $group => [ qw(1 1 n) ] }, 'LIST works');
        is_deeply([$n->group($group)], [ qw(0 1 1), $group ], 'GROUP works');
        is_deeply($n->listgroup($group), [1], 'listgroup OK');
-       ok(!$n->starttls, 'STARTTLS fails when unconfigured');
-       is($n->code, 580, 'got 580 code on server w/o TLS');
+
+       SKIP: {
+               $n->can('starttls') or
+                       skip('Net::NNTP too old to support STARTTLS', 2);
+               ok(!$n->starttls, 'STARTTLS fails when unconfigured');
+               is($n->code, 580, 'got 580 code on server w/o TLS');
+       };
 
        %opts = (
                PeerAddr => $host_port,