about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-30 21:00:27 +0000
committerEric Wong <e@80x24.org>2015-09-30 21:09:25 +0000
commit58c7600f8fc4d9970793a214c22cab52540968f7 (patch)
tree9f2b34311122944f8581a118ec873108c5afadb3 /t
parentbb93ee6601ac6ca5fb6ff0e9d4d1cfcbb73e7f58 (diff)
downloadpublic-inbox-58c7600f8fc4d9970793a214c22cab52540968f7.tar.gz
More testing is good, especially since clients I use
don't implement all the commands.
Diffstat (limited to 't')
-rw-r--r--t/nntpd.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/nntpd.t b/t/nntpd.t
index 8a721e20..ecb876f9 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -176,6 +176,25 @@ EOF
                 is($r[2], '.', 'correctly terminated response');
         }
 
+        is_deeply($n->xhdr(qw(Cc 1-)), { 1 => 'test-nntpd@example.com' },
+                 'XHDR Cc 1- works');
+        is_deeply($n->xhdr(qw(References 1-)), { 1 => '' },
+                 'XHDR References 1- works (empty string)');
+        is_deeply($n->xhdr(qw(list-id 1-)), {},
+                 'XHDR on invalid header returns empty');
+
+        {
+                syswrite($s, "HDR List-id 1-\r\n");
+                $buf = '';
+                do {
+                        sysread($s, $buf, 4096, length($buf));
+                } until ($buf =~ /\r\n\z/);
+                my @r = split("\r\n", $buf);
+                like($r[0], qr/^5\d\d /,
+                        'got 5xx response for unoptimized HDR');
+                is(scalar @r, 1, 'only one response line');
+        }
+
         ok(kill('TERM', $pid), 'killed nntpd');
         $pid = undef;
         waitpid(-1, 0);