]> Sergey Matveev's repositories - public-inbox.git/commitdiff
nntp: add test case for the "DATE" command
authorEric Wong <e@80x24.org>
Tue, 13 Dec 2016 03:10:11 +0000 (03:10 +0000)
committerEric Wong <e@80x24.org>
Tue, 13 Dec 2016 03:46:23 +0000 (03:46 +0000)
We may not always use strftime and may implement caching.
But for now, just add a test.

t/nntpd.t

index 7192d7819dd6d12e9a758581da373042cc39091b..ad50a64fd7bb7b9d155bbdb339463db50476f72e 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -202,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-');