[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
- [Emacs-diffs] master 8c04e65 01/12: Have newsticker use iso8601 to parse dates, (continued)
- [Emacs-diffs] master 8c04e65 01/12: Have newsticker use iso8601 to parse dates, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master 07ce3be 02/12: `decoded-time-set-defaults' refactored out from iso8601 code, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master 46df7bb 03/12: Add new function time-zone-format, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master 14c0a63 04/12: Make time-zone-format take a SHORT parameter, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master e82ae1d 06/12: decoded-time-dst doc fix, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master 6a87416 05/12: Use iso8601-parse in nnrss, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master 4dcb692 07/12: Default DST to "undecided" in decoded-time-set-defaults, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master fa648a5 08/12: Allow timezone defaults in decoded-time-set-defaults, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master 1ab6445 10/12: Fix time zone in previous rewrite of newsticker--decode-iso8601-date, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master c8f1e17 11/12: Rewrite `url-dav-process-date-property' to use parse-time, Lars Ingebrigtsen, 2019/07/31
- [Emacs-diffs] master a79e96f 12/12: Add more icalendar tests (for the isodatetime parser),
Lars Ingebrigtsen <=
- [Emacs-diffs] master 296002b 09/12: Rewrite `parse-iso8601-time-string' to use `iso8601-parse', Lars Ingebrigtsen, 2019/07/31