summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Whatson2023-01-05 20:33:24 +1000
committerArun Isaac2023-01-06 14:27:18 +0000
commitaa6a58a152b8ebe0e786682ffd84239ed862dba4 (patch)
treeb4146031c0c1b1c49b114ad3d3302c53545ce07a /tests
parentca88c0899277a8e897538bda5b1bca2f2747cd61 (diff)
downloadguile-email-aa6a58a152b8ebe0e786682ffd84239ed862dba4.tar.gz
guile-email-aa6a58a152b8ebe0e786682ffd84239ed862dba4.tar.lz
guile-email-aa6a58a152b8ebe0e786682ffd84239ed862dba4.zip
email: Support Date fields with missing seconds.
* email/email.scm (parse-email-headers): Extend the date-time parser to
match when seconds are missing, defaulting to "0".
* tests/email.scm ("parse Date", "parse Date without seconds"): New
tests.

Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/email.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/email.scm b/tests/email.scm
index a6d2b46..481909a 100644
--- a/tests/email.scm
+++ b/tests/email.scm
@@ -1,6 +1,7 @@
 ;;; guile-email --- Guile email parser
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018, 2019, 2020, 2021 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2023 Andrew Whatson <whatson@tailcall.au>
 ;;;
 ;;; This file was adapted from guile-debbugs and is part of guile-email.
 ;;;
@@ -558,6 +559,16 @@ Content-Type: text/plain; charset=utf-8
                   (charset . "utf-8"))
     (content-transfer-encoding . 7bit)))
 
+(test-alist= "parse Date without seconds"
+  (parse-email-headers
+   "Date: Tue, 22 Nov 94 17:52 GMT
+")
+  `((date . ,(make-date 0 0 52 17 22 11 1994 0))
+    (content-type (type . text)
+                  (subtype . plain)
+                  (charset . "utf-8"))
+    (content-transfer-encoding . 7bit)))
+
 
 ;;;
 ;;; Email addresses