unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/5] t/nntpd.t: stop hard coding message :bytes into test
Date: Mon,  2 May 2016 18:01:24 +0000	[thread overview]
Message-ID: <20160502180125.21277-5-e@80x24.org> (raw)
In-Reply-To: <20160502180125.21277-1-e@80x24.org>

It limits flexibility and makes it harder to switch
to use PublicImport::Import.
---
 t/nntpd.t | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/t/nntpd.t b/t/nntpd.t
index d033221..b026bd5 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -46,6 +46,7 @@ my %opts = (
 );
 my $sock = IO::Socket::INET->new(%opts);
 my $pid;
+my $len;
 END { kill 'TERM', $pid if defined $pid };
 {
 	local $ENV{HOME} = $home;
@@ -69,6 +70,8 @@ EOF
 		IPC::Run::run([$mda], \$in);
 		is(0, $?, 'ran MDA correctly');
 		is(0, system($index, $maindir), 'indexed git dir');
+		$simple->header_set('List-Id', "<$addr>");
+		$len = length($simple->as_string);
 	}
 
 	ok($sock, 'sock created');
@@ -151,7 +154,7 @@ EOF
 			'Thu, 01 Jan 1970 06:06:06 +0000',
 			'<nntp@example.com>',
 			'',
-			'202',
+			$len,
 			'1' ] }, "XOVER range works");
 
 	is_deeply($n->xover('1'), {
@@ -160,7 +163,7 @@ EOF
 			'Thu, 01 Jan 1970 06:06:06 +0000',
 			'<nntp@example.com>',
 			'',
-			'202',
+			$len,
 			'1' ] }, "XOVER by article works");
 
 	{
@@ -173,7 +176,7 @@ EOF
 		like($r[0], qr/^224 /, 'got 224 response for OVER');
 		is($r[1], "0\thihi\tMe <me\@example.com>\t" .
 			"Thu, 01 Jan 1970 06:06:06 +0000\t" .
-			"$mid\t\t202\t1", 'OVER by Message-ID works');
+			"$mid\t\t$len\t1", 'OVER by Message-ID works');
 		is($r[2], '.', 'correctly terminated response');
 	}
 

  parent reply	other threads:[~2016-05-02 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02 18:01 [PATCH 0/5] miscellaneous minor changes Eric Wong
2016-05-02 18:01 ` [PATCH 1/5] http: remove needless binmode call Eric Wong
2016-05-02 18:01 ` [PATCH 2/5] view: disable subject threading Eric Wong
2016-05-02 18:01 ` [PATCH 3/5] nntp: append Archived-At and List-Archive headers Eric Wong
2016-05-02 18:01 ` Eric Wong [this message]
2016-05-02 18:01 ` [PATCH 5/5] t/*.t: reduce -mda calls Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160502180125.21277-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).