diff options
| author | Lars Ingebrigtsen | 2019-07-31 21:04:50 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-31 21:47:29 +0200 |
| commit | a79e96f0f9133b0577e709f805179ab59b09fe33 (patch) | |
| tree | 89b2e91aa77b105570f69bea9b177263b0d254ed /test | |
| parent | c8f1e17e6be1545557f10c3e8039e655ace6ab1c (diff) | |
| download | emacs-a79e96f0f9133b0577e709f805179ab59b09fe33.tar.gz emacs-a79e96f0f9133b0577e709f805179ab59b09fe33.zip | |
Add more icalendar tests (for the isodatetime parser)
* test/lisp/calendar/icalendar-tests.el
(icalendar-tests--decode-isodatetime): Test
`icalendar--decode-isodatetime'.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/calendar/icalendar-tests.el | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/lisp/calendar/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el index af617e677f1..baea4804045 100644 --- a/test/lisp/calendar/icalendar-tests.el +++ b/test/lisp/calendar/icalendar-tests.el | |||
| @@ -2325,5 +2325,31 @@ END:VCALENDAR | |||
| 2325 | ) | 2325 | ) |
| 2326 | ) | 2326 | ) |
| 2327 | 2327 | ||
| 2328 | (defun icalendar-test--format (string &optional day zone) | ||
| 2329 | (let ((time (icalendar--decode-isodatetime string day zone))) | ||
| 2330 | (format-time-string "%FT%T%z" (encode-time time) 0))) | ||
| 2331 | |||
| 2332 | (defun icalendar-tests--decode-isodatetime (ical-string) | ||
| 2333 | (should (equal (icalendar-test--format "20040917T050910-0200") | ||
| 2334 | "2004-09-17T03:09:10+0000")) | ||
| 2335 | (should (equal (icalendar-test--format "20040917T050910") | ||
| 2336 | "2004-09-17T03:09:10+0000")) | ||
| 2337 | (should (equal (icalendar-test--format "20040917T050910Z") | ||
| 2338 | "2004-09-17T05:09:10+0000")) | ||
| 2339 | (should (equal (icalendar-test--format "20040917T0509") | ||
| 2340 | "2004-09-17T03:09:00+0000")) | ||
| 2341 | (should (equal (icalendar-test--format "20040917") | ||
| 2342 | "2004-09-16T22:00:00+0000")) | ||
| 2343 | (should (equal (icalendar-test--format "20040917T050910" 1) | ||
| 2344 | "2004-09-18T03:09:10+0000")) | ||
| 2345 | (should (equal (icalendar-test--format "20040917T050910" 30) | ||
| 2346 | "2004-10-17T03:09:10+0000")) | ||
| 2347 | (should (equal (icalendar-test--format "20040917T050910" -1) | ||
| 2348 | "2004-09-16T03:09:10+0000")) | ||
| 2349 | |||
| 2350 | (should (equal (icalendar-test--format "20040917T050910" nil -3600) | ||
| 2351 | "2004-09-17T06:09:10+0000"))) | ||
| 2352 | |||
| 2353 | |||
| 2328 | (provide 'icalendar-tests) | 2354 | (provide 'icalendar-tests) |
| 2329 | ;;; icalendar-tests.el ends here | 2355 | ;;; icalendar-tests.el ends here |