From 9da3ece5da22c2d446299a787af9e974b2f9b398 Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Mon, 2 May 2016 07:36:05 +0000
Subject: [PATCH] t/nntpd.t: stop hard coding message :bytes into test

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 d0332216..b026bd56 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');
 	}
 
-- 
2.51.0