summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/email.scm56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/email.scm b/tests/email.scm
index d0eed13..530cb8b 100644
--- a/tests/email.scm
+++ b/tests/email.scm
@@ -102,6 +102,62 @@ Content-Length: 4349
(x-mailer . "FooMail 4.0 4.03 (SMT460B92F)")
(content-length . "4349")))
+(test-equal "RFC5322 A.1.1. A message from one person to another with simple addressing"
+ (parse-email
+ "From: John Doe <jdoe@machine.example>
+Sender: Michael Jones <mjones@machine.example>
+To: Mary Smith <mary@example.net>
+Subject: Saying Hello
+Date: Fri, 21 Nov 1997 09:55:06 -0600
+Message-ID: <1234@local.machine.example>
+
+This is a message just to say hello.
+So, \"Hello\".")
+ (make-email
+ `((content-type (type . text)
+ (subtype . plain)
+ (charset . "utf-8"))
+ (content-transfer-encoding . 7bit)
+ (from ((name . "John Doe")
+ (address . "jdoe@machine.example")))
+ (sender (name . "Michael Jones")
+ (address . "mjones@machine.example"))
+ (to ((name . "Mary Smith")
+ (address . "mary@example.net")))
+ (subject . "Saying Hello")
+ (date . ,(make-date 0 6 55 9 21 11 1997 -21600))
+ (message-id . "1234@local.machine.example"))
+ "This is a message just to say hello.
+So, \"Hello\"."))
+
+(test-equal "RFC5322 A.1.2. Different types of mailboxes"
+ (parse-email
+ "From: \"Joe Q. Public\" <john.q.public@example.com>
+To: Mary Smith <mary@x.test>, jdoe@example.org, Who? <one@y.test>
+Cc: <boss@nil.test>, \"Giant; \\\"Big\\\" Box\" <sysservices@example.net>
+Date: Tue, 1 Jul 2003 10:52:37 +0200
+Message-ID: <5678.21-Nov-1997@example.com>
+
+Hi everyone.")
+ (make-email
+ `((content-type (type . text)
+ (subtype . plain)
+ (charset . "utf-8"))
+ (content-transfer-encoding . 7bit)
+ (from ((name . "Joe Q. Public")
+ (address . "john.q.public@example.com")))
+ (to ((name . "Mary Smith")
+ (address . "mary@x.test"))
+ ((address . "jdoe@example.org"))
+ ((name . "Who?")
+ (address . "one@y.test")))
+ (cc ((address . "boss@nil.test"))
+ ((name . "Giant; \"Big\" Box")
+ (address . "sysservices@example.net")))
+ (date . ,(make-date 0 37 52 10 1 7 2003 7200))
+ (message-id . "5678.21-Nov-1997@example.com"))
+ "Hi everyone."))
+
(test-equal "RFC2046 5.1.1. Common syntax"
(parse-email
(string->bytevector