From 3f53b5fe72fe888ab953bea2eac49ec9def7c6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 16 Nov 2016 13:28:26 +0100 Subject: [PATCH] Skip tests with unportable commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch skips unportable tests whose return code is 500. It usually mean the server does not suport it. Signed-off-by: Petr Písař --- test.pl | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test.pl b/test.pl index 4f21575..26a100c 100644 --- a/test.pl +++ b/test.pl @@ -33,17 +33,32 @@ EOF $i = 2; +sub skip_500_ok { + my ($counter, $client, $function, @arguments) = @_; + my $status = $client->$function(@arguments); + my $code = $client->code(); + if ($code != 500) { + print "not " unless $status; + print "ok ", ${$counter}++, " ($f)\n"; + } else { + print "ok ", ${$counter}++, " # skip ($f is unsupported by the server)\n"; + } +} + $c = new News::NNTPClient; $c->gmt(1); $c->fourdigityear(1); for $f (qw(version debug eol gmt fourdigityear message code - ok okprint postok mode_reader list help slave)) { + ok okprint postok mode_reader list help)) { print "not " unless $c->$f(); print "ok ", $i++, " ($f)\n"; } +# slave not supported by inn +skip_500_ok(\$i, $c, 'slave'); + print <xpath($msgid); -print "ok ", $i++, " (xpath $msgid)\n"; +skip_500_ok(\$i, $c, 'xpath', $msgid); for $f (qw(xgtitle xhdr xpat xover xmotd xthread xindex xsearch)) { - print "not " unless $c->$f(); - print "ok ", $i++, " ($f)\n"; + skip_500_ok(\$i, $c, $f); } print <