about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-29 11:14:43 +0000
committerEric Wong <e@yhbt.net>2020-04-30 07:34:00 +0000
commitd4507254cc1261c535e48994c99b1e3c7e1f3be2 (patch)
tree9aa8f0fbd8b854790aa7c5b6cc42ea2e05aac65b
parent129c630a7ec3e100bba272631c3880b9beac9cef (diff)
downloadpublic-inbox-d4507254cc1261c535e48994c99b1e3c7e1f3be2.tar.gz
t/precheck: remove Email::Simple->create from tests
It's likely we'll replace Email::Simple using our Email::MIME
alternative/replacement, as well.  So reduce the API surface we
interact with and make it easier to swap implementations.
-rw-r--r--t/precheck.t90
1 files changed, 43 insertions, 47 deletions
diff --git a/t/precheck.t b/t/precheck.t
index 53d4fb2b..a8fd31b1 100644
--- a/t/precheck.t
+++ b/t/precheck.t
@@ -27,65 +27,61 @@ sub do_checks {
 }
 
 {
-        my $s = Email::Simple->create(
-                header => [
-                        From => 'abc@example.com',
-                        To => 'abc@example.com',
-                        Cc => 'c@example.com, another-list@example.com',
-                        'Content-Type' => 'text/plain',
-                        Subject => 'list is fine',
-                        'Message-ID' => '<MID@host>',
-                        Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
-                ],
-                body => "hello world\n",
-        );
+        my $s = Email::Simple->new(<<'EOF');
+From: abc@example.com
+To: abc@example.com
+Cc: c@example.com, another-list@example.com
+Content-Type: text/plain
+Subject: list is fine
+Message-ID: <MID@host>
+Date: Wed, 09 Apr 2014 01:28:34 +0000
+
+hello world
+EOF
         my $addr = [ 'c@example.com', 'd@example.com' ];
         ok(PublicInbox::MDA->precheck($s, $addr), 'Cc list is OK');
 }
 
 {
-        do_checks(Email::Simple->create(
-                header => [
-                        From => 'a@example.com',
-                        To => 'b@example.com',
-                        Cc => 'c@example.com',
-                        'Content-Type' => 'text/plain',
-                        Subject => 'this is a subject',
-                        'Message-ID' => '<MID@host>',
-                        Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
-                ],
-                body => "hello world\n",
-        ));
+        do_checks(Email::Simple->new(<<'EOF'));
+From: a@example.com
+To: b@example.com
+Cc: c@example.com
+Content-Type: text/plain
+Subject: this is a subject
+Message-ID: <MID@host>
+Date: Wed, 09 Apr 2014 01:28:34 +0000
+
+hello world
+EOF
 }
 
 {
-        do_checks(Email::Simple->create(
-                header => [
-                        From => 'a@example.com',
-                        To => 'b+plus@example.com',
-                        Cc => 'John Doe <c@example.com>',
-                        'Content-Type' => 'text/plain',
-                        Subject => 'this is a subject',
-                        'Message-ID' => '<MID@host>',
-                        Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
-                ],
-                body => "hello world\n",
-        ));
+        do_checks(Email::Simple->new(<<'EOF'));
+From: a@example.com
+To: b+plus@example.com
+Cc: John Doe <c@example.com>
+Content-Type: text/plain
+Subject: this is a subject
+Message-ID: <MID@host>
+Date: Wed, 09 Apr 2014 01:28:34 +0000
+
+hello world
+EOF
 }
 
 {
         my $recipient = 'b@example.com';
-        my $s = Email::Simple->create(
-                header => [
-                        To => 'b@example.com',
-                        Cc => 'c@example.com',
-                        'Content-Type' => 'text/plain',
-                        Subject => 'this is a subject',
-                        'Message-ID' => '<MID@host>',
-                        Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
-                ],
-                body => "hello world\n",
-        );
+        my $s = Email::Simple->new(<<'EOF');
+To: b@example.com
+Cc: c@example.com
+Content-Type: text/plain
+Subject: this is a subject
+Message-ID: <MID@host>
+Date: Wed, 09 Apr 2014 01:28:34 +0000
+
+hello world
+EOF
         ok(!PublicInbox::MDA->precheck($s, $recipient),
                 "missing From: is rejected");
 }