From: Eric Wong <e@80x24.org>
Date: Tue, 13 Dec 2016 03:10:11 +0000 (+0000)
Subject: nntp: add test case for the "DATE" command
X-Git-Tag: v1.0.0~139
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=ed15c484cdc3daec5abe224a349c083ec3b2db53;p=public-inbox.git

nntp: add test case for the "DATE" command

We may not always use strftime and may implement caching.
But for now, just add a test.
---

diff --git a/t/nntpd.t b/t/nntpd.t
index 7192d781..ad50a64f 100644
--- 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-');