X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fnntpd.t;h=56b1d604518558e67284580f08076eef6820c4d9;hb=3d41aa23f35501ca92aab8aa42980fa73f7fa74f;hp=c5bc0b54fb76bdbbd941c10f1da94a4cda485afc;hpb=528230a0411897a14cbb79d0dae02ea89827bf1e;p=public-inbox.git
diff --git a/t/nntpd.t b/t/nntpd.t
index c5bc0b54..56b1d604 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -1,5 +1,5 @@
-# Copyright (C) 2015 all contributors
-# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+# Copyright (C) 2015-2018 all contributors
+# License: AGPL-3.0+
use strict;
use warnings;
use Test::More;
@@ -62,7 +62,9 @@ Content-Transfer-Encoding: 8bit
This is a test message for El\xc3\xa9anor
EOF
- $mime->header_set('List-Id', "<$addr>");
+ my $list_id = $addr;
+ $list_id =~ s/@/./;
+ $mime->header_set('List-Id', "<$list_id>");
$len = length($mime->as_string);
my $git = PublicInbox::Git->new($maindir);
my $im = PublicInbox::Import->new($git, 'test', $addr);
@@ -173,6 +175,16 @@ EOF
$len,
'1' ] }, "XOVER by article works");
+ is_deeply($n->head(1), $n->head(''), 'HEAD OK');
+ is_deeply($n->body(1), $n->body(''), 'BODY OK');
+ is($n->body(1)->[0], "This is a test message for El\xc3\xa9anor\n",
+ 'body really matches');
+ my $art = $n->article(1);
+ is(ref($art), 'ARRAY', 'got array for ARTICLE');
+ is_deeply($art, $n->article(''), 'ARTICLE OK');
+ is($n->article(999), undef, 'non-existent num');
+ is($n->article(''), undef, 'non-existent mid');
+
{
syswrite($s, "OVER $mid\r\n");
$buf = read_til_dot($s);
@@ -192,6 +204,14 @@ EOF
is_deeply($n->xhdr(qw(list-id 1-)), {},
'XHDR on invalid header returns empty');
+ {
+ my $t0 = time;
+ my $date = $n->date;
+ my $t1 = time;
+ ok($date >= $t0, 'valid date after start');
+ ok($date <= $t1, 'valid date before stop');
+ }
+
{
setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1);
syswrite($s, 'HDR List-id 1-');
@@ -209,6 +229,7 @@ EOF
is(scalar @r, 1, 'only one response line');
}
+ $n = $s = undef;
is($pid, waitpid($pid, 0), 'nntpd exited successfully');
my $eout = eval {
local $/;