From c85e6917ea21631857d93f58e60d910e07317131 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 28 Jul 2019 12:26:22 +0530 Subject: tests: Add examples from RFC5322 A.1.1 and A.1.2. * tests/email.scm ("RFC5322 A.1.1. A message from one person to another with simple addressing", "RFC5322 A.1.2. Different types of mailboxes"): New tests. --- tests/email.scm | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) 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 +Sender: Michael Jones +To: Mary Smith +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\" +To: Mary Smith , jdoe@example.org, Who? +Cc: , \"Giant; \\\"Big\\\" Box\" +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 -- cgit v1.2.3