From 837f40590396617df78983cfddc586156b1abce9 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 28 Jul 2019 00:08:21 +0530 Subject: tests: Add example from RFC2046 5.1.1. * tests/email.scm ("RFC2046 5.1.1. Common syntax"): New test. --- tests/email.scm | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'tests/email.scm') diff --git a/tests/email.scm b/tests/email.scm index 177391e..d0eed13 100644 --- a/tests/email.scm +++ b/tests/email.scm @@ -102,6 +102,59 @@ Content-Length: 4349 (x-mailer . "FooMail 4.0 4.03 (SMT460B92F)") (content-length . "4349"))) +(test-equal "RFC2046 5.1.1. Common syntax" + (parse-email + (string->bytevector + "From: Nathaniel Borenstein +To: Ned Freed +Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST) +Subject: Sample message +MIME-Version: 1.0 +Content-type: multipart/mixed; boundary=\"simple boundary\" + +This is the preamble. It is to be ignored, though it +is a handy place for composition agents to include an +explanatory note to non-MIME conformant readers. + +--simple boundary + +This is implicitly typed plain US-ASCII text. +It does NOT end with a linebreak. +--simple boundary +Content-type: text/plain; charset=us-ascii + +This is explicitly typed plain US-ASCII text. +It DOES end with a linebreak. + +--simple boundary-- + +This is the epilogue. It is also to be ignored. +" "utf-8")) + (make-email + `((content-transfer-encoding . 7bit) + (from ((name . "Nathaniel Borenstein") + (address . "nsb@bellcore.com"))) + (to ((name . "Ned Freed") + (address . "ned@innosoft.com"))) + (date . ,(make-date 0 48 56 23 21 3 1993 -28800)) + (subject . "Sample message") + (mime-version . "1.0") + (content-type (type . multipart) + (subtype . mixed) + (boundary . "simple boundary"))) + (list (make-mime-entity '((content-type (type . text) + (subtype . plain) + (charset . "utf-8")) + (content-transfer-encoding . 7bit)) + "This is implicitly typed plain US-ASCII text. +It does NOT end with a linebreak.") + (make-mime-entity '((content-transfer-encoding . 7bit) + (content-type (type . text) + (subtype . plain) + (charset . "us-ascii"))) + "This is explicitly typed plain US-ASCII text. +It DOES end with a linebreak.")))) + (test-equal "decode MIME entity without headers" ((module-ref (resolve-module '(email email)) 'parse-mime-entity) -- cgit v1.2.3