]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/nntpd.t
mda: set List-ID correctly according to RFC2919
[public-inbox.git] / t / nntpd.t
index 5f4ba57ba0c3b89bc0fe7e6b528ba723f50b9ef7..2ccc90fbad785254516f6c26c9e93e223e7abdda 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -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);
@@ -175,6 +177,8 @@ EOF
 
        is_deeply($n->head(1), $n->head('<nntp@example.com>'), 'HEAD OK');
        is_deeply($n->body(1), $n->body('<nntp@example.com>'), '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('<nntp@example.com>'), 'ARTICLE OK');
@@ -200,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-');
@@ -217,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 $/;