]> Sergey Matveev's repositories - public-inbox.git/commitdiff
nntp: fix for missing articles/bodies/heads
authorEric Wong <e@80x24.org>
Sun, 29 May 2016 04:10:48 +0000 (04:10 +0000)
committerEric Wong <e@80x24.org>
Sun, 29 May 2016 04:11:34 +0000 (04:11 +0000)
Oops, we totally forgot to automate testing for this :x

lib/PublicInbox/NNTP.pm
t/nntpd.t

index 58b86a8297a5ba5e4a60941c5533277530e9235d..232237c2dfe8eb0947b83cc0859632baa2617e27 100644 (file)
@@ -485,7 +485,7 @@ find_mid:
 found:
        my $o = 'HEAD:' . mid2path($mid);
        my $bytes;
-       my $s = eval { Email::Simple->new($ng->gcf->cat_file($o, \$bytes)) };
+       my $s = eval { Email::Simple->new($ng->git->cat_file($o, \$bytes)) };
        return $err unless $s;
        my $lines;
        if ($set_headers) {
index c5bc0b54fb76bdbbd941c10f1da94a4cda485afc..5f4ba57ba0c3b89bc0fe7e6b528ba723f50b9ef7 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -173,6 +173,14 @@ EOF
                        $len,
                        '1' ] }, "XOVER by article works");
 
+       is_deeply($n->head(1), $n->head('<nntp@example.com>'), 'HEAD OK');
+       is_deeply($n->body(1), $n->body('<nntp@example.com>'), 'BODY OK');
+       my $art = $n->article(1);
+       is(ref($art), 'ARRAY', 'got array for ARTICLE');
+       is_deeply($art, $n->article('<nntp@example.com>'), 'ARTICLE OK');
+       is($n->article(999), undef, 'non-existent num');
+       is($n->article('<non-existent@example>'), undef, 'non-existent mid');
+
        {
                syswrite($s, "OVER $mid\r\n");
                $buf = read_til_dot($s);