aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2019-07-28 00:08:21 +0530
committerArun Isaac2019-07-28 12:13:43 +0530
commit837f40590396617df78983cfddc586156b1abce9 (patch)
tree45e7e4d4a7d67f772c5f74a55e3a8293cd7c441a
parent9ac10570fca04800f04a439e484f41421864b99f (diff)
downloadguile-email-837f40590396617df78983cfddc586156b1abce9.tar.gz
guile-email-837f40590396617df78983cfddc586156b1abce9.tar.lz
guile-email-837f40590396617df78983cfddc586156b1abce9.zip
tests: Add example from RFC2046 5.1.1.
* tests/email.scm ("RFC2046 5.1.1. Common syntax"): New test.
-rw-r--r--tests/email.scm53
1 files changed, 53 insertions, 0 deletions
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 <nsb@bellcore.com>
+To: Ned Freed <ned@innosoft.com>
+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)