X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=xt%2Fmem-msgview.t;h=dceb24b2386a322fa2ad0d806c2bc96f0c379fc5;hb=2186e8a06ca468f89a22fb66d8b337fa7bc0d8de;hp=1ea0f559ee0a329482bba0db94524843a1dc8332;hpb=033f628b52ebacf4a7bf8795084ba5ec498004bf;p=public-inbox.git diff --git a/xt/mem-msgview.t b/xt/mem-msgview.t index 1ea0f559..dceb24b2 100644 --- a/xt/mem-msgview.t +++ b/xt/mem-msgview.t @@ -1,17 +1,19 @@ #!perl -w -# Copyright (C) 2020 all contributors +# Copyright (C) 2020-2021 all contributors # License: AGPL-3.0+ +# Note: this may be altered as-needed to demonstrate improvements. +# See history in git for this file. use strict; use IO::Handle; # ->flush use Fcntl qw(SEEK_SET); use PublicInbox::TestCommon; use PublicInbox::Tmpfile; -use PublicInbox::WWW; use Test::More; -my @mods = qw(DBD::SQLite BSD::Resource); +my @mods = qw(DBD::SQLite BSD::Resource PublicInbox::WWW); require_mods(@mods); use_ok($_) for @mods; -my $lines = $ENV{NR_LINES} // 100000; +my $lines = $ENV{NR_LINES} // 50000; +diag "NR_LINES=$lines"; my ($tmpdir, $for_destroy) = tmpdir(); my $inboxname = 'big'; my $inboxdir = "$tmpdir/big"; @@ -32,29 +34,39 @@ EOF 'inbox initialized'); $fh = tmpfile('big.eml', undef, my $append = 1) or die; - printf($fh <<'EOF', $addr, $mid) or die; + my $hdr = sprintf(<<'EOF', $addr, $mid); From: Dr. X To: Nikki <%s> Date: Tue, 3 May 1988 00:00:00 +0000 Subject: todo Message-ID: <%s> +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="FOO" +Content-Disposition: inline + +--FOO +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline + +EOF + print $fh $hdr or die; + for (0..$lines) { print $fh 'x' x 72, "\n" or die } + print $fh <flush or die; sysseek($fh, 0, SEEK_SET) or die; my $env = { ORIGINAL_RECIPIENT => $addr }; my $err = ''; my $opt = { 0 => $fh, 2 => \$err, run_mode => 0 }; ok(run_script([qw(-mda --no-precheck)], $env, $opt), - '1st message delivered'); - - # resend the message with same mid but different content - print $fh "mindcrime\n" or die; - $fh->flush or die; - sysseek($fh, 0, SEEK_SET) or die; - ok(run_script([qw(-mda --no-precheck)], $env, $opt), - '2nd message delivered'); + 'message delivered'); } my $www = PublicInbox::WWW->new;