From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C4C6D201C8 for ; Wed, 30 Sep 2015 21:00:31 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 12/12] t/nntpd.t: additional tests for XHDR/HDR Date: Wed, 30 Sep 2015 21:00:27 +0000 Message-Id: <20150930210027.30479-13-e@80x24.org> In-Reply-To: <20150930210027.30479-1-e@80x24.org> References: <20150930210027.30479-1-e@80x24.org> List-Id: More testing is good, especially since clients I use don't implement all the commands. --- t/nntpd.t | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/t/nntpd.t b/t/nntpd.t index 8a721e2..ecb876f 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -176,6 +176,25 @@ EOF is($r[2], '.', 'correctly terminated response'); } + is_deeply($n->xhdr(qw(Cc 1-)), { 1 => 'test-nntpd@example.com' }, + 'XHDR Cc 1- works'); + is_deeply($n->xhdr(qw(References 1-)), { 1 => '' }, + 'XHDR References 1- works (empty string)'); + is_deeply($n->xhdr(qw(list-id 1-)), {}, + 'XHDR on invalid header returns empty'); + + { + syswrite($s, "HDR List-id 1-\r\n"); + $buf = ''; + do { + sysread($s, $buf, 4096, length($buf)); + } until ($buf =~ /\r\n\z/); + my @r = split("\r\n", $buf); + like($r[0], qr/^5\d\d /, + 'got 5xx response for unoptimized HDR'); + is(scalar @r, 1, 'only one response line'); + } + ok(kill('TERM', $pid), 'killed nntpd'); $pid = undef; waitpid(-1, 0); -- EW