emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master a79e96f 12/12: Add more icalendar tests (for the is


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master a79e96f 12/12: Add more icalendar tests (for the isodatetime parser)
Date: Wed, 31 Jul 2019 15:47:59 -0400 (EDT)

branch: master
commit a79e96f0f9133b0577e709f805179ab59b09fe33
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Add more icalendar tests (for the isodatetime parser)
    
    * test/lisp/calendar/icalendar-tests.el
    (icalendar-tests--decode-isodatetime): Test
    `icalendar--decode-isodatetime'.
---
 test/lisp/calendar/icalendar-tests.el | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/test/lisp/calendar/icalendar-tests.el 
b/test/lisp/calendar/icalendar-tests.el
index af617e6..baea480 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -2325,5 +2325,31 @@ END:VCALENDAR
 )
   )
 
+(defun icalendar-test--format (string &optional day zone)
+  (let ((time (icalendar--decode-isodatetime string day zone)))
+    (format-time-string "%FT%T%z" (encode-time time) 0)))
+
+(defun icalendar-tests--decode-isodatetime (ical-string)
+  (should (equal (icalendar-test--format "20040917T050910-0200")
+                 "2004-09-17T03:09:10+0000"))
+  (should (equal (icalendar-test--format "20040917T050910")
+                 "2004-09-17T03:09:10+0000"))
+  (should (equal (icalendar-test--format "20040917T050910Z")
+                 "2004-09-17T05:09:10+0000"))
+  (should (equal (icalendar-test--format "20040917T0509")
+                 "2004-09-17T03:09:00+0000"))
+  (should (equal (icalendar-test--format "20040917")
+                 "2004-09-16T22:00:00+0000"))
+  (should (equal (icalendar-test--format "20040917T050910" 1)
+                 "2004-09-18T03:09:10+0000"))
+  (should (equal (icalendar-test--format "20040917T050910" 30)
+                 "2004-10-17T03:09:10+0000"))
+  (should (equal (icalendar-test--format "20040917T050910" -1)
+                 "2004-09-16T03:09:10+0000"))
+
+  (should (equal (icalendar-test--format "20040917T050910" nil -3600)
+                 "2004-09-17T06:09:10+0000")))
+
+
 (provide 'icalendar-tests)
 ;;; icalendar-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]