X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fnntpd.t;h=ad50a64fd7bb7b9d155bbdb339463db50476f72e;hb=4ba430497bfb4763691b0ad8af573eb6ff420b96;hp=c5bc0b54fb76bdbbd941c10f1da94a4cda485afc;hpb=528230a0411897a14cbb79d0dae02ea89827bf1e;p=public-inbox.git diff --git a/t/nntpd.t b/t/nntpd.t index c5bc0b54..ad50a64f 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -173,6 +173,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 +202,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 +227,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 $/;