about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-21 21:16:14 +0000
committerEric Wong <e@yhbt.net>2020-04-22 18:26:07 +0000
commit5f113019334c3fcdcc71e8a573c30ec10f7bcbb9 (patch)
tree35d60e3a8c365049dd3f89c8ba28cc4b53e4ecbd
parente6b7a7f5f70fb89a54ff158bc6c8b564149947e5 (diff)
downloadpublic-inbox-5f113019334c3fcdcc71e8a573c30ec10f7bcbb9.tar.gz
Totally pointless to create an object only to convert
it back to a raw string for -mda input.
-rw-r--r--t/mda.t18
1 files changed, 5 insertions, 13 deletions
diff --git a/t/mda.t b/t/mda.t
index dc691616..fb505146 100644
--- a/t/mda.t
+++ b/t/mda.t
@@ -87,7 +87,7 @@ die $@ if $@;
         local $ENV{PI_EMERGENCY} = $faildir;
         local $ENV{HOME} = $home;
         local $ENV{ORIGINAL_RECIPIENT} = $addr;
-        my $simple = Email::Simple->new(<<EOF);
+        my $in = <<EOF;
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
@@ -96,8 +96,6 @@ Subject: hihi
 Date: Thu, 01 Jan 1970 00:00:00 +0000
 
 EOF
-        my $in = $simple->as_string;
-
         # ensure successful message delivery
         {
                 local $ENV{PATH} = $main_path;
@@ -177,7 +175,7 @@ Date: deadbeef
         local $ENV{ORIGINAL_RECIPIENT} = $addr;
         local $ENV{PATH} = $main_path;
         my $mid = 'spam-train@example.com';
-        my $simple = Email::Simple->new(<<EOF);
+        my $in = <<EOF;
 From: Spammer <spammer\@example.com>
 To: You <you\@example.com>
 Cc: $addr
@@ -186,8 +184,6 @@ Subject: this message will be trained as spam
 Date: Thu, 01 Jan 1970 00:00:00 +0000
 
 EOF
-        my $in = $simple->as_string;
-
         {
                 # deliver the spam message, first
                 ok(run_script(['-mda'], undef, { 0 => \$in }));
@@ -214,7 +210,7 @@ EOF
         local $ENV{ORIGINAL_RECIPIENT} = $addr;
         local $ENV{PATH} = $main_path;
         my $mid = 'ham-train@example.com';
-        my $simple = Email::Simple->new(<<EOF);
+        my $in = <<EOF;
 From: False-positive <hammer\@example.com>
 To: You <you\@example.com>
 Cc: $addr
@@ -223,8 +219,6 @@ Subject: this message will be trained as spam
 Date: Thu, 01 Jan 1970 00:00:00 +0000
 
 EOF
-        my $in = $simple->as_string;
-
         # now train it
         # these should be overridden
         local $ENV{GIT_AUTHOR_EMAIL} = 'trainer@example.com';
@@ -288,7 +282,7 @@ EOF
         local $ENV{PATH} = $main_path;
         my $list_id = 'foo.example.com';
         my $mid = 'list-id-delivery@example.com';
-        my $simple = Email::Simple->new(<<EOF);
+        my $in = <<EOF;
 From: user <user\@example.com>
 To: You <you\@example.com>
 Cc: $addr
@@ -300,7 +294,6 @@ Date: Thu, 01 Jan 1970 00:00:00 +0000
 EOF
         xsys(qw(git config --file), $pi_config, "$cfgpfx.listid", $list_id);
         $? == 0 or die "failed to set listid $?";
-        my $in = $simple->as_string;
         ok(run_script(['-mda'], undef, { 0 => \$in }),
                 'mda OK with List-Id match');
         my $path = mid2path($mid);
@@ -308,13 +301,12 @@ EOF
         like($$msg, qr/\Q$list_id\E/, 'delivered message w/ List-ID matches');
 
         # try a message w/o precheck
-        $simple = Email::Simple->new(<<EOF);
+        $in = <<EOF;
 To: You <you\@example.com>
 List-Id: <$list_id>
 
 this message would not be accepted without --no-precheck
 EOF
-        $in = $simple->as_string;
         my ($out, $err) = ('', '');
         my $rdr = { 0 => \$in, 1 => \$out, 2 => \$err };
         ok(run_script(['-mda', '--no-precheck'], undef, $rdr),