1 ;; icalendar-tests.el --- Test suite for icalendar.el
3 ;; Copyright (C) 2005, 2008-2016 Free Software Foundation, Inc.
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
8 ;; Human-Keywords: calendar, diary, iCalendar, vCalendar
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; - Add more unit tests for functions, timezone etc.
30 ;; Note: Watch the trailing blank that is added on import.
38 ;; ======================================================================
40 ;; ======================================================================
42 (defun icalendar-tests--get-ical-event (ical-string)
43 "Return iCalendar event for ICAL-STRING."
47 (goto-char (point-min))
48 (car (icalendar--read-element nil nil)))))
50 (defun icalendar-tests--trim (string)
51 "Remove leading and trailing whitespace from STRING."
52 (replace-regexp-in-string "[ \t\n]+\\'" ""
53 (replace-regexp-in-string "\\`[ \t\n]+" "" string)))
55 ;; ======================================================================
57 ;; ======================================================================
59 (ert-deftest icalendar--create-uid ()
60 "Test for `icalendar--create-uid'."
61 (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s")
62 (icalendar--uid-count 77)
63 (entry-full "30.06.1964 07:01 blahblah")
64 (hash (format "%d" (abs (sxhash entry-full))))
65 (contents "DTSTART:19640630T070100\nblahblah")
66 (username (or user-login-name "UNKNOWN_USER")))
67 (ert-with-function-mocked current-time (lambda () '(1 2 3))
68 (should (= 77 icalendar--uid-count))
69 (should (string= (concat "xxx-123-77-" hash "-" username "-19640630")
70 (icalendar--create-uid entry-full contents)))
71 (should (= 78 icalendar--uid-count)))
72 (setq contents "blahblah")
73 (setq icalendar-uid-format "yyy%syyy")
74 (should (string= (concat "yyyDTSTARTyyy")
75 (icalendar--create-uid entry-full contents)))))
77 (ert-deftest icalendar-convert-anniversary-to-ical ()
78 "Test method for `icalendar--convert-anniversary-to-ical'."
79 (let* ((calendar-date-style 'iso)
81 (setq result (icalendar--convert-anniversary-to-ical
82 "" "%%(diary-anniversary 1964 6 30) g"))
83 (should (consp result))
84 (should (string= (concat
85 "\nDTSTART;VALUE=DATE:19640630"
86 "\nDTEND;VALUE=DATE:19640701"
87 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
89 (should (string= "g" (cdr result)))))
91 (ert-deftest icalendar--convert-cyclic-to-ical ()
92 "Test method for `icalendar--convert-cyclic-to-ical'."
93 (let* ((calendar-date-style 'iso)
95 (setq result (icalendar--convert-block-to-ical
96 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
97 (should (consp result))
98 (should (string= (concat
99 "\nDTSTART;VALUE=DATE:20040719"
100 "\nDTEND;VALUE=DATE:20040828")
102 (should (string= "Sommerferien" (cdr result)))))
104 (ert-deftest icalendar--convert-block-to-ical ()
105 "Test method for `icalendar--convert-block-to-ical'."
106 (let* ((calendar-date-style 'iso)
108 (setq result (icalendar--convert-block-to-ical
109 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
110 (should (consp result))
111 (should (string= (concat
112 "\nDTSTART;VALUE=DATE:20040719"
113 "\nDTEND;VALUE=DATE:20040828")
115 (should (string= "Sommerferien" (cdr result)))))
117 (ert-deftest icalendar--convert-yearly-to-ical ()
118 "Test method for `icalendar--convert-yearly-to-ical'."
119 (let* ((calendar-date-style 'iso)
121 (calendar-month-name-array
122 ["January" "February" "March" "April" "May" "June" "July" "August"
123 "September" "October" "November" "December"]))
124 (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
125 (should (consp result))
126 (should (string= (concat
127 "\nDTSTART;VALUE=DATE:19000501"
128 "\nDTEND;VALUE=DATE:19000502"
129 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
131 (should (string= "Tag der Arbeit" (cdr result)))))
133 (ert-deftest icalendar--convert-weekly-to-ical ()
134 "Test method for `icalendar--convert-weekly-to-ical'."
135 (let* ((calendar-date-style 'iso)
137 (calendar-day-name-array
138 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
140 (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
141 (should (consp result))
142 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
143 "\nDTEND;VALUE=DATE-TIME:20050103T093000"
144 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
146 (should (string= "subject" (cdr result)))))
148 (ert-deftest icalendar--convert-sexp-to-ical ()
149 "Test method for `icalendar--convert-sexp-to-ical'."
151 (icalendar-export-sexp-enumeration-days 3))
152 ;; test case %%(diary-hebrew-date)
153 (setq result (icalendar--convert-sexp-to-ical "" "%%(diary-hebrew-date)"))
154 (should (consp result))
155 (should (eq icalendar-export-sexp-enumeration-days (length result)))
158 (should (string-match "Hebrew date (until sunset): .*" (cdr i))))
161 (ert-deftest icalendar--convert-to-ical ()
162 "Test method for `icalendar--convert-to-ical'."
164 (icalendar-export-sexp-enumerate-all t)
165 (icalendar-export-sexp-enumeration-days 3)
166 (calendar-date-style 'iso))
167 ;; test case: %%(diary-anniversary 1642 12 25) Newton
168 ;; forced enumeration not matching the actual day --> empty
169 (setq result (icalendar--convert-sexp-to-ical
170 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
171 (encode-time 1 1 1 6 12 2014)))
172 (should (null result))
173 ;; test case: %%(diary-anniversary 1642 12 25) Newton
174 ;; enumeration does match the actual day -->
175 (setq result (icalendar--convert-sexp-to-ical
176 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
177 (encode-time 1 1 1 24 12 2014)))
178 (should (= 1 (length result)))
179 (should (consp (car result)))
180 (should (string-match
181 "\nDTSTART;VALUE=DATE:20141225\nDTEND;VALUE=DATE:20141226"
183 (should (string-match "Newton's birthday" (cdr (car result))))))
185 (ert-deftest icalendar--parse-vtimezone ()
186 "Test method for `icalendar--parse-vtimezone'."
187 (let (vtimezone result)
188 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
191 DTSTART:16010101T040000
194 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
197 DTSTART:16010101T030000
200 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
204 (setq result (icalendar--parse-vtimezone vtimezone))
205 (should (string= "thename" (car result)))
206 (message (cdr result))
207 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
209 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
210 TZID:anothername, with a comma
212 DTSTART:16010101T040000
215 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
218 DTSTART:16010101T030000
221 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
225 (setq result (icalendar--parse-vtimezone vtimezone))
226 (should (string= "anothername, with a comma" (car result)))
227 (message (cdr result))
228 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
230 ;; offsetfrom = offsetto
231 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
232 TZID:Kolkata, Chennai, Mumbai, New Delhi
233 X-MICROSOFT-CDO-TZID:23
235 DTSTART:16010101T000000
240 DTSTART:16010101T000000
246 (setq result (icalendar--parse-vtimezone vtimezone))
247 (should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result)))
248 (message (cdr result))
249 (should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00"
252 (ert-deftest icalendar--convert-ordinary-to-ical ()
253 "Test method for `icalendar--convert-ordinary-to-ical'."
254 (let* ((calendar-date-style 'iso)
257 (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
258 (should (consp result))
259 (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
261 (should (string= "subject" (cdr result)))
264 (setq result (icalendar--convert-ordinary-to-ical
265 "&?" "&2010 2 15 12:34 s"))
266 (should (consp result))
267 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
268 "\nDTEND;VALUE=DATE-TIME:20100215T133400")
270 (should (string= "s" (cdr result)))
273 (setq result (icalendar--convert-ordinary-to-ical
274 "&?" "&2010 2 15 12:34-23:45 s"))
275 (should (consp result))
276 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
277 "\nDTEND;VALUE=DATE-TIME:20100215T234500")
279 (should (string= "s" (cdr result)))
281 ;; with time, again -- test bug#5549
282 (setq result (icalendar--convert-ordinary-to-ical
283 "x?" "x2010 2 15 0:34-1:45 s"))
284 (should (consp result))
285 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
286 "\nDTEND;VALUE=DATE-TIME:20100215T014500")
288 (should (string= "s" (cdr result)))))
290 (ert-deftest icalendar--diarytime-to-isotime ()
291 "Test method for `icalendar--diarytime-to-isotime'."
292 (should (string= "T011500"
293 (icalendar--diarytime-to-isotime "01:15" "")))
294 (should (string= "T011500"
295 (icalendar--diarytime-to-isotime "1:15" "")))
296 (should (string= "T000100"
297 (icalendar--diarytime-to-isotime "0:01" "")))
298 (should (string= "T010000"
299 (icalendar--diarytime-to-isotime "0100" "")))
300 (should (string= "T010000"
301 (icalendar--diarytime-to-isotime "0100" "am")))
302 (should (string= "T130000"
303 (icalendar--diarytime-to-isotime "0100" "pm")))
304 (should (string= "T120000"
305 (icalendar--diarytime-to-isotime "1200" "")))
306 (should (string= "T171700"
307 (icalendar--diarytime-to-isotime "17:17" "")))
308 (should (string= "T000000"
309 (icalendar--diarytime-to-isotime "1200" "am")))
310 (should (string= "T000100"
311 (icalendar--diarytime-to-isotime "1201" "am")))
312 (should (string= "T005900"
313 (icalendar--diarytime-to-isotime "1259" "am")))
314 (should (string= "T120000"
315 (icalendar--diarytime-to-isotime "1200" "pm")))
316 (should (string= "T120100"
317 (icalendar--diarytime-to-isotime "1201" "pm")))
318 (should (string= "T125900"
319 (icalendar--diarytime-to-isotime "1259" "pm")))
320 (should (string= "T150000"
321 (icalendar--diarytime-to-isotime "3" "pm"))))
323 (ert-deftest icalendar--datetime-to-diary-date ()
324 "Test method for `icalendar--datetime-to-diary-date'."
325 (let* ((datetime '(59 59 23 31 12 2008))
326 (calendar-date-style 'iso))
327 (should (string= "2008 12 31"
328 (icalendar--datetime-to-diary-date datetime)))
329 (setq calendar-date-style 'european)
330 (should (string= "31 12 2008"
331 (icalendar--datetime-to-diary-date datetime)))
332 (setq calendar-date-style 'american)
333 (should (string= "12 31 2008"
334 (icalendar--datetime-to-diary-date datetime)))))
336 (ert-deftest icalendar--datestring-to-isodate ()
337 "Test method for `icalendar--datestring-to-isodate'."
338 (let ((calendar-date-style 'iso))
340 (should (string= "20080511"
341 (icalendar--datestring-to-isodate "2008 05 11")))
342 (should (string= "20080531"
343 (icalendar--datestring-to-isodate "2008 05 31")))
344 (should (string= "20080602"
345 (icalendar--datestring-to-isodate "2008 05 31" 2)))
348 (setq calendar-date-style 'european)
349 (should (string= "20080511"
350 (icalendar--datestring-to-isodate "11 05 2008")))
351 (should (string= "20080531"
352 (icalendar--datestring-to-isodate "31 05 2008")))
353 (should (string= "20080602"
354 (icalendar--datestring-to-isodate "31 05 2008" 2)))
357 (setq calendar-date-style 'american)
358 (should (string= "20081105"
359 (icalendar--datestring-to-isodate "11 05 2008")))
360 (should (string= "20081230"
361 (icalendar--datestring-to-isodate "12 30 2008")))
362 (should (string= "20090101"
363 (icalendar--datestring-to-isodate "12 30 2008" 2)))
366 (setq calendar-date-style nil) ;not necessary for conversion
367 (should (string= "20081105"
368 (icalendar--datestring-to-isodate "Nov 05 2008")))
369 (should (string= "20081105"
370 (icalendar--datestring-to-isodate "05 Nov 2008")))
371 (should (string= "20081105"
372 (icalendar--datestring-to-isodate "2008 Nov 05")))))
374 (ert-deftest icalendar--first-weekday-of-year ()
375 "Test method for `icalendar-first-weekday-of-year'."
376 (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
377 (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
378 (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
379 (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
380 (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
381 (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
382 (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
383 (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
384 (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
386 (ert-deftest icalendar--import-format-sample ()
387 "Test method for `icalendar-import-format-sample'."
388 (should (string= (concat "SUMMARY='a' DESCRIPTION='b' LOCATION='c' "
389 "ORGANIZER='d' STATUS='' URL='' CLASS=''")
390 (icalendar-import-format-sample
391 (icalendar-tests--get-ical-event "BEGIN:VEVENT
392 DTSTAMP:20030509T043439Z
393 DTSTART:20030509T103000
397 DTEND:20030509T153000
402 (ert-deftest icalendar--format-ical-event ()
403 "Test `icalendar--format-ical-event'."
404 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
405 (icalendar-import-format-summary "SUM %s")
406 (icalendar-import-format-location " LOC %s")
407 (icalendar-import-format-description " DES %s")
408 (icalendar-import-format-organizer " ORG %s")
409 (icalendar-import-format-status " STA %s")
410 (icalendar-import-format-url " URL %s")
411 (icalendar-import-format-class " CLA %s")
412 (event (icalendar-tests--get-ical-event "BEGIN:VEVENT
413 DTSTAMP:20030509T043439Z
414 DTSTART:20030509T103000
418 DTEND:20030509T153000
422 (should (string= "SUM sum DES des LOC loc ORG org"
423 (icalendar--format-ical-event event)))
424 (setq icalendar-import-format (lambda (&rest ignore)
426 (should (string= "helloworld" (icalendar--format-ical-event event)))
427 (setq icalendar-import-format
429 (format "-%s-%s-%s-%s-%s-%s-%s-"
430 (icalendar--get-event-property event 'SUMMARY)
431 (icalendar--get-event-property event 'DESCRIPTION)
432 (icalendar--get-event-property event 'LOCATION)
433 (icalendar--get-event-property event 'ORGANIZER)
434 (icalendar--get-event-property event 'STATUS)
435 (icalendar--get-event-property event 'URL)
436 (icalendar--get-event-property event 'CLASS))))
437 (should (string= "-sum-des-loc-org-nil-nil-nil-"
438 (icalendar--format-ical-event event)))))
440 (ert-deftest icalendar--parse-summary-and-rest ()
441 "Test `icalendar--parse-summary-and-rest'."
442 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
443 (icalendar-import-format-summary "SUM %s")
444 (icalendar-import-format-location " LOC %s")
445 (icalendar-import-format-description " DES %s")
446 (icalendar-import-format-organizer " ORG %s")
447 (icalendar-import-format-status " STA %s")
448 (icalendar-import-format-url " URL %s")
449 (icalendar-import-format-class " CLA %s")
451 (setq result (icalendar--parse-summary-and-rest "SUM sum ORG org"))
452 (should (string= "org" (cdr (assoc 'org result))))
454 (setq result (icalendar--parse-summary-and-rest
455 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
456 (should (string= "des" (cdr (assoc 'des result))))
457 (should (string= "loc" (cdr (assoc 'loc result))))
458 (should (string= "org" (cdr (assoc 'org result))))
459 (should (string= "sta" (cdr (assoc 'sta result))))
460 (should (string= "cla" (cdr (assoc 'cla result))))
462 (setq icalendar-import-format (lambda () "Hello world"))
463 (setq result (icalendar--parse-summary-and-rest
465 (should (not result))
468 (ert-deftest icalendar--decode-isodatetime ()
469 "Test `icalendar--decode-isodatetime'."
470 (let ((tz (getenv "TZ"))
474 ;; Use Eastern European Time (UTC+2, UTC+3 daylight saving)
475 (setenv "TZ" "EET-2EEST,M3.5.0/3,M10.5.0/4")
477 (message "%s" (current-time-zone (encode-time 0 0 10 1 1 2013 0)))
478 (message "%s" (current-time-zone (encode-time 0 0 10 1 8 2013 0)))
480 ;; testcase: no time zone in input -> keep time as is
482 (should (equal '(0 0 10 1 1 2013 2 nil 7200)
483 (icalendar--decode-isodatetime "20130101T100000")))
484 ;; 1 Aug 2013 10:00 (DST)
485 (should (equal '(0 0 10 1 8 2013 4 t 10800)
486 (icalendar--decode-isodatetime "20130801T100000")))
488 ;; testcase: UTC time zone specifier in input -> convert to local time
489 ;; 31 Dec 2013 23:00 UTC -> 1 Jan 2013 01:00 EET
490 (should (equal '(0 0 1 1 1 2014 3 nil 7200)
491 (icalendar--decode-isodatetime "20131231T230000Z")))
492 ;; 1 Aug 2013 10:00 UTC -> 1 Aug 2013 13:00 EEST
493 (should (equal '(0 0 13 1 8 2013 4 t 10800)
494 (icalendar--decode-isodatetime "20130801T100000Z")))
497 ;; restore time-zone even if something went terribly wrong
500 ;; ======================================================================
502 ;; ======================================================================
504 (defun icalendar-tests--test-export (input-iso input-european input-american
505 expected-output &optional alarms)
506 "Perform an export test.
507 Argument INPUT-ISO iso style diary string.
508 Argument INPUT-EUROPEAN european style diary string.
509 Argument INPUT-AMERICAN american style diary string.
510 Argument EXPECTED-OUTPUT expected iCalendar result string.
511 Optional argument ALARMS the value of `icalendar-export-alarms' for this test.
513 European style input data must use german month names. American
514 and ISO style input data must use english month names."
515 (let ((tz (getenv "TZ"))
516 (calendar-date-style 'iso)
517 (icalendar-recurring-start-year 2000)
518 (icalendar-export-alarms alarms))
521 ;;; (message "Current time zone: %s" (current-time-zone))
522 ;; Use this form so as not to rely on system tz database.
523 ;; Eg hydra.nixos.org.
524 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
525 ;;; (message "Current time zone: %s" (current-time-zone))
527 (let ((calendar-month-name-array
528 ["January" "February" "March" "April" "May" "June" "July" "August"
529 "September" "October" "November" "December"])
530 (calendar-day-name-array
531 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
533 (setq calendar-date-style 'iso)
534 (icalendar-tests--do-test-export input-iso expected-output)))
536 (let ((calendar-month-name-array
537 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
538 "September" "Oktober" "November" "Dezember"])
539 (calendar-day-name-array
540 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
542 (setq calendar-date-style 'european)
543 (icalendar-tests--do-test-export input-european expected-output)))
545 (let ((calendar-month-name-array
546 ["January" "February" "March" "April" "May" "June" "July" "August"
547 "September" "October" "November" "December"])
548 (calendar-day-name-array
549 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
551 (setq calendar-date-style 'american)
552 (icalendar-tests--do-test-export input-american expected-output))))
553 ;; restore time-zone even if something went terribly wrong
556 (defun icalendar-tests--do-test-export (input expected-output)
557 "Actually perform export test.
558 Argument INPUT input diary string.
559 Argument EXPECTED-OUTPUT expected iCalendar result string."
560 (let ((temp-file (make-temp-file "icalendar-tests-ics")))
565 (icalendar-export-region (point-min) (point-max) temp-file))
567 (find-file temp-file)
568 (goto-char (point-min))
569 (cond (expected-output
570 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
571 PRODID:-//Emacs//NONSGML icalendar.el//EN
580 (should (string-match
582 (regexp-quote (buffer-substring-no-properties
583 (match-beginning 1) (match-end 1)))
587 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
588 PRODID:-//Emacs//NONSGML icalendar.el//EN
594 (kill-buffer (find-buffer-visiting temp-file))
595 (delete-file temp-file))))
597 (ert-deftest icalendar-export-ordinary-no-time ()
598 "Perform export test."
600 (let ((icalendar-export-hidden-diary-entries nil))
601 (icalendar-tests--test-export
602 "&2000 Oct 3 ordinary no time "
603 "&3 Okt 2000 ordinary no time "
604 "&Oct 3 2000 ordinary no time "
607 (icalendar-tests--test-export
608 "2000 Oct 3 ordinary no time "
609 "3 Okt 2000 ordinary no time "
610 "Oct 3 2000 ordinary no time "
611 "DTSTART;VALUE=DATE:20001003
612 DTEND;VALUE=DATE:20001004
613 SUMMARY:ordinary no time
616 (ert-deftest icalendar-export-ordinary ()
617 "Perform export test."
619 (icalendar-tests--test-export
620 "2000 Oct 3 16:30 ordinary with time"
621 "3 Okt 2000 16:30 ordinary with time"
622 "Oct 3 2000 16:30 ordinary with time"
623 "DTSTART;VALUE=DATE-TIME:20001003T163000
624 DTEND;VALUE=DATE-TIME:20001003T173000
625 SUMMARY:ordinary with time
627 (icalendar-tests--test-export
628 "2000 10 3 16:30 ordinary with time 2"
629 "3 10 2000 16:30 ordinary with time 2"
630 "10 3 2000 16:30 ordinary with time 2"
631 "DTSTART;VALUE=DATE-TIME:20001003T163000
632 DTEND;VALUE=DATE-TIME:20001003T173000
633 SUMMARY:ordinary with time 2
636 (icalendar-tests--test-export
637 "2000/10/3 16:30 ordinary with time 3"
638 "3/10/2000 16:30 ordinary with time 3"
639 "10/3/2000 16:30 ordinary with time 3"
640 "DTSTART;VALUE=DATE-TIME:20001003T163000
641 DTEND;VALUE=DATE-TIME:20001003T173000
642 SUMMARY:ordinary with time 3
645 (ert-deftest icalendar-export-multiline ()
646 "Perform export test."
648 ;; multiline -- FIXME!!!
649 (icalendar-tests--test-export
650 "2000 October 3 16:30 multiline
651 17:30 multiline continued FIXME"
652 "3 Oktober 2000 16:30 multiline
653 17:30 multiline continued FIXME"
654 "October 3 2000 16:30 multiline
655 17:30 multiline continued FIXME"
656 "DTSTART;VALUE=DATE-TIME:20001003T163000
657 DTEND;VALUE=DATE-TIME:20001003T173000
660 17:30 multiline continued FIXME
663 (ert-deftest icalendar-export-weekly-by-day ()
664 "Perform export test."
667 (icalendar-tests--test-export
668 "Monday 1:30pm weekly by day with start time"
669 "Montag 13:30 weekly by day with start time"
670 "Monday 1:30pm weekly by day with start time"
671 "DTSTART;VALUE=DATE-TIME:20000103T133000
672 DTEND;VALUE=DATE-TIME:20000103T143000
673 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
674 SUMMARY:weekly by day with start time
677 (icalendar-tests--test-export
678 "Monday 13:30-15:00 weekly by day with start and end time"
679 "Montag 13:30-15:00 weekly by day with start and end time"
680 "Monday 01:30pm-03:00pm weekly by day with start and end time"
681 "DTSTART;VALUE=DATE-TIME:20000103T133000
682 DTEND;VALUE=DATE-TIME:20000103T150000
683 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
684 SUMMARY:weekly by day with start and end time
687 (ert-deftest icalendar-export-yearly ()
688 "Perform export test."
690 (icalendar-tests--test-export
691 "may 1 yearly no time"
692 "1 Mai yearly no time"
693 "may 1 yearly no time"
694 "DTSTART;VALUE=DATE:19000501
695 DTEND;VALUE=DATE:19000502
696 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
697 SUMMARY:yearly no time
700 (ert-deftest icalendar-export-anniversary ()
701 "Perform export test."
703 (icalendar-tests--test-export
704 "%%(diary-anniversary 1989 10 3) anniversary no time"
705 "%%(diary-anniversary 3 10 1989) anniversary no time"
706 "%%(diary-anniversary 10 3 1989) anniversary no time"
707 "DTSTART;VALUE=DATE:19891003
708 DTEND;VALUE=DATE:19891004
709 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
710 SUMMARY:anniversary no time
712 (icalendar-tests--test-export
713 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
714 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
715 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
716 "DTSTART;VALUE=DATE-TIME:19891003T190000
717 DTEND;VALUE=DATE-TIME:19891004T200000
718 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
719 SUMMARY:anniversary with time
722 (ert-deftest icalendar-export-block ()
723 "Perform export test."
725 (icalendar-tests--test-export
726 "%%(diary-block 2001 6 18 2001 7 6) block no time"
727 "%%(diary-block 18 6 2001 6 7 2001) block no time"
728 "%%(diary-block 6 18 2001 7 6 2001) block no time"
729 "DTSTART;VALUE=DATE:20010618
730 DTEND;VALUE=DATE:20010707
731 SUMMARY:block no time
733 (icalendar-tests--test-export
734 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
735 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
736 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
737 "DTSTART;VALUE=DATE-TIME:20010618T130000
738 DTEND;VALUE=DATE-TIME:20010618T170000
739 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
740 SUMMARY:block with time
742 (icalendar-tests--test-export
743 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
744 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
745 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
746 "DTSTART;VALUE=DATE-TIME:20010618T130000
747 DTEND;VALUE=DATE-TIME:20010618T140000
748 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
749 SUMMARY:block no end time
752 (ert-deftest icalendar-export-alarms ()
753 "Perform export test with different settings for exporting alarms."
755 (icalendar-tests--test-export
756 "2014 Nov 17 19:30 no alarm"
757 "17 Nov 2014 19:30 no alarm"
758 "Nov 17 2014 19:30 no alarm"
759 "DTSTART;VALUE=DATE-TIME:20141117T193000
760 DTEND;VALUE=DATE-TIME:20141117T203000
765 ;; 10 minutes in advance, audio
766 (icalendar-tests--test-export
767 "2014 Nov 17 19:30 audio alarm"
768 "17 Nov 2014 19:30 audio alarm"
769 "Nov 17 2014 19:30 audio alarm"
770 "DTSTART;VALUE=DATE-TIME:20141117T193000
771 DTEND;VALUE=DATE-TIME:20141117T203000
780 ;; 20 minutes in advance, display
781 (icalendar-tests--test-export
782 "2014 Nov 17 19:30 display alarm"
783 "17 Nov 2014 19:30 display alarm"
784 "Nov 17 2014 19:30 display alarm"
785 "DTSTART;VALUE=DATE-TIME:20141117T193000
786 DTEND;VALUE=DATE-TIME:20141117T203000
787 SUMMARY:display alarm
791 DESCRIPTION:display alarm
796 ;; 66 minutes in advance, email
797 (icalendar-tests--test-export
798 "2014 Nov 17 19:30 email alarm"
799 "17 Nov 2014 19:30 email alarm"
800 "Nov 17 2014 19:30 email alarm"
801 "DTSTART;VALUE=DATE-TIME:20141117T193000
802 DTEND;VALUE=DATE-TIME:20141117T203000
807 DESCRIPTION:email alarm
809 ATTENDEE:MAILTO:att.one@email.com
810 ATTENDEE:MAILTO:att.two@email.com
813 '(66 ((email ("att.one@email.com" "att.two@email.com")))))
815 ;; 2 minutes in advance, all alarms
816 (icalendar-tests--test-export
817 "2014 Nov 17 19:30 all alarms"
818 "17 Nov 2014 19:30 all alarms"
819 "Nov 17 2014 19:30 all alarms"
820 "DTSTART;VALUE=DATE-TIME:20141117T193000
821 DTEND;VALUE=DATE-TIME:20141117T203000
826 DESCRIPTION:all alarms
828 ATTENDEE:MAILTO:att.one@email.com
829 ATTENDEE:MAILTO:att.two@email.com
838 DESCRIPTION:all alarms
841 '(2 ((email ("att.one@email.com" "att.two@email.com")) (audio) (display)))))
843 ;; ======================================================================
845 ;; ======================================================================
847 (defun icalendar-tests--test-import (input expected-iso expected-european
849 "Perform import test.
850 Argument INPUT icalendar event string.
851 Argument EXPECTED-ISO expected iso style diary string.
852 Argument EXPECTED-EUROPEAN expected european style diary string.
853 Argument EXPECTED-AMERICAN expected american style diary string.
854 During import test the timezone is set to Central European Time."
855 (let ((timezone (getenv "TZ")))
858 ;; Use this form so as not to rely on system tz database.
859 ;; Eg hydra.nixos.org.
860 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
862 (if (string-match "^BEGIN:VCALENDAR" input)
864 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
865 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
867 (unless (eq (char-before) ?\n)
869 (insert "END:VEVENT\nEND:VCALENDAR\n"))
870 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
871 (icalendar-import-format-summary "%s")
872 (icalendar-import-format-location "\n Location: %s")
873 (icalendar-import-format-description "\n Desc: %s")
874 (icalendar-import-format-organizer "\n Organizer: %s")
875 (icalendar-import-format-status "\n Status: %s")
876 (icalendar-import-format-url "\n URL: %s")
877 (icalendar-import-format-class "\n Class: %s")
878 (icalendar-import-format-uid "\n UID: %s")
881 (setq calendar-date-style 'iso)
882 (icalendar-tests--do-test-import input expected-iso))
883 (when expected-european
884 (setq calendar-date-style 'european)
885 (icalendar-tests--do-test-import input expected-european))
886 (when expected-american
887 (setq calendar-date-style 'american)
888 (icalendar-tests--do-test-import input expected-american)))))
889 (setenv "TZ" timezone))))
891 (defun icalendar-tests--do-test-import (input expected-output)
892 "Actually perform import test.
893 Argument INPUT input icalendar string.
894 Argument EXPECTED-OUTPUT expected diary string."
895 (let ((temp-file (make-temp-file "icalendar-test-diary")))
896 ;; Test the Catch-the-mysterious-coding-header logic below.
897 ;; Ruby-mode adds an after-save-hook which inserts the header!
899 ;; (find-file temp-file)
901 (icalendar-import-buffer temp-file t t)
903 (find-file temp-file)
904 ;; Check for the mysterious "# coding: ..." header, remove it
906 (goto-char (point-min))
907 (when (re-search-forward "# coding: .*?\n" nil t)
908 (message (concat "%s\n"
909 "Found mysterious \"# coding ...\" header! Removing it.\n"
910 "Current Modes: %s, %s\n"
918 (buffer-disable-undo)
920 (set-buffer-modified-p nil))
922 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
923 (should (string= expected-output result)))
924 (kill-buffer (find-buffer-visiting temp-file))
925 (delete-file temp-file))))
927 (ert-deftest icalendar-import-non-recurring ()
928 "Perform standard import tests."
929 (icalendar-tests--test-import
930 "SUMMARY:non-recurring
931 DTSTART;VALUE=DATE-TIME:20030919T090000
932 DTEND;VALUE=DATE-TIME:20030919T113000"
933 "&2003/9/19 09:00-11:30 non-recurring\n"
934 "&19/9/2003 09:00-11:30 non-recurring\n"
935 "&9/19/2003 09:00-11:30 non-recurring\n")
936 (icalendar-tests--test-import
937 "SUMMARY:non-recurring allday
938 DTSTART;VALUE=DATE-TIME:20030919"
939 "&2003/9/19 non-recurring allday\n"
940 "&19/9/2003 non-recurring allday\n"
941 "&9/19/2003 non-recurring allday\n")
942 (icalendar-tests--test-import
943 ;; Checkdoc removes trailing blanks. Therefore: format!
944 (format "%s\n%s\n%s" "SUMMARY:long " " summary"
945 "DTSTART;VALUE=DATE:20030919")
946 "&2003/9/19 long summary\n"
947 "&19/9/2003 long summary\n"
948 "&9/19/2003 long summary\n")
949 (icalendar-tests--test-import
950 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
954 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
955 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
956 DTSTART;VALUE=DATE:20040719
957 DTEND;VALUE=DATE:20040828
958 DTSTAMP:20031103T011641Z
960 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
963 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
965 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
968 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
970 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
973 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
975 (icalendar-tests--test-import
977 :04979712-3902-11d9-93dd-8f9f4afe08da
984 X-MOZILLA-ALARM-DEFAULT-LENGTH
995 "&2004/11/23 14:00-14:30 folded summary
998 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
999 "&23/11/2004 14:00-14:30 folded summary
1002 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
1003 "&11/23/2004 14:00-14:30 folded summary
1006 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
1008 (icalendar-tests--test-import
1010 :6161a312-3902-11d9-b512-f764153bb28b
1017 X-MOZILLA-ALARM-DEFAULT-LENGTH
1026 "&2004/11/23 14:45-15:45 another example
1029 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1030 "&23/11/2004 14:45-15:45 another example
1033 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1034 "&11/23/2004 14:45-15:45 another example
1037 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
1039 (ert-deftest icalendar-import-rrule ()
1040 (icalendar-tests--test-import
1041 "SUMMARY:rrule daily
1042 DTSTART;VALUE=DATE-TIME:20030919T090000
1043 DTEND;VALUE=DATE-TIME:20030919T113000
1046 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily\n"
1047 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily\n"
1048 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily\n")
1050 (icalendar-tests--test-import
1051 "SUMMARY:rrule daily
1052 DTSTART;VALUE=DATE-TIME:20030919T090000
1053 DTEND;VALUE=DATE-TIME:20030919T113000
1054 RRULE:FREQ=DAILY;INTERVAL=2
1056 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily\n"
1057 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily\n"
1058 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily\n")
1059 (icalendar-tests--test-import
1060 "SUMMARY:rrule daily with exceptions
1061 DTSTART;VALUE=DATE-TIME:20030919T090000
1062 DTEND;VALUE=DATE-TIME:20030919T113000
1063 RRULE:FREQ=DAILY;INTERVAL=2
1064 EXDATE:20030921,20030925
1066 "&%%(and (not (diary-date 2003 9 25)) (not (diary-date 2003 9 21)) (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily with exceptions\n"
1067 "&%%(and (not (diary-date 25 9 2003)) (not (diary-date 21 9 2003)) (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily with exceptions\n"
1068 "&%%(and (not (diary-date 9 25 2003)) (not (diary-date 9 21 2003)) (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily with exceptions\n")
1069 (icalendar-tests--test-import
1070 "SUMMARY:rrule weekly
1071 DTSTART;VALUE=DATE-TIME:20030919T090000
1072 DTEND;VALUE=DATE-TIME:20030919T113000
1075 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly\n"
1076 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly\n"
1077 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly\n")
1078 (icalendar-tests--test-import
1079 "SUMMARY:rrule monthly no end
1080 DTSTART;VALUE=DATE-TIME:20030919T090000
1081 DTEND;VALUE=DATE-TIME:20030919T113000
1084 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end\n"
1085 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n"
1086 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n")
1087 (icalendar-tests--test-import
1088 "SUMMARY:rrule monthly with end
1089 DTSTART;VALUE=DATE-TIME:20030919T090000
1090 DTEND;VALUE=DATE-TIME:20030919T113000
1091 RRULE:FREQ=MONTHLY;UNTIL=20050819;
1093 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end\n"
1094 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end\n"
1095 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end\n")
1096 (icalendar-tests--test-import
1097 "DTSTART;VALUE=DATE:20040815
1098 DTEND;VALUE=DATE:20040816
1099 SUMMARY:Maria Himmelfahrt
1100 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
1102 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
1103 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt\n"
1104 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt\n")
1105 (icalendar-tests--test-import
1106 "SUMMARY:rrule yearly
1107 DTSTART;VALUE=DATE-TIME:20030919T090000
1108 DTEND;VALUE=DATE-TIME:20030919T113000
1109 RRULE:FREQ=YEARLY;INTERVAL=2
1111 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly\n" ;FIXME
1112 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly\n" ;FIXME
1113 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly\n") ;FIXME
1114 (icalendar-tests--test-import
1115 "SUMMARY:rrule count daily short
1116 DTSTART;VALUE=DATE-TIME:20030919T090000
1117 DTEND;VALUE=DATE-TIME:20030919T113000
1118 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
1120 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short\n"
1121 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short\n"
1122 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short\n")
1123 (icalendar-tests--test-import
1124 "SUMMARY:rrule count daily long
1125 DTSTART;VALUE=DATE-TIME:20030919T090000
1126 DTEND;VALUE=DATE-TIME:20030919T113000
1127 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
1129 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long\n"
1130 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long\n"
1131 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long\n")
1132 (icalendar-tests--test-import
1133 "SUMMARY:rrule count bi-weekly 3 times
1134 DTSTART;VALUE=DATE-TIME:20030919T090000
1135 DTEND;VALUE=DATE-TIME:20030919T113000
1136 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
1138 "&%%(and (diary-cyclic 14 2003 9 19) (diary-block 2003 9 19 2003 10 31)) 09:00-11:30 rrule count bi-weekly 3 times\n"
1139 "&%%(and (diary-cyclic 14 19 9 2003) (diary-block 19 9 2003 31 10 2003)) 09:00-11:30 rrule count bi-weekly 3 times\n"
1140 "&%%(and (diary-cyclic 14 9 19 2003) (diary-block 9 19 2003 10 31 2003)) 09:00-11:30 rrule count bi-weekly 3 times\n")
1141 (icalendar-tests--test-import
1142 "SUMMARY:rrule count monthly
1143 DTSTART;VALUE=DATE-TIME:20030919T090000
1144 DTEND;VALUE=DATE-TIME:20030919T113000
1145 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
1147 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly\n"
1148 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly\n"
1149 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly\n")
1150 (icalendar-tests--test-import
1151 "SUMMARY:rrule count every second month
1152 DTSTART;VALUE=DATE-TIME:20030919T090000
1153 DTEND;VALUE=DATE-TIME:20030919T113000
1154 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
1156 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month\n" ;FIXME
1157 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month\n" ;FIXME
1158 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month\n") ;FIXME
1159 (icalendar-tests--test-import
1160 "SUMMARY:rrule count yearly
1161 DTSTART;VALUE=DATE-TIME:20030919T090000
1162 DTEND;VALUE=DATE-TIME:20030919T113000
1163 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
1165 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly\n"
1166 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly\n"
1167 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly\n")
1168 (icalendar-tests--test-import
1169 "SUMMARY:rrule count every second year
1170 DTSTART;VALUE=DATE-TIME:20030919T090000
1171 DTEND;VALUE=DATE-TIME:20030919T113000
1172 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
1174 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year\n" ;FIXME!!!
1175 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year\n" ;FIXME!!!
1176 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year\n") ;FIXME!!!
1179 (ert-deftest icalendar-import-duration ()
1181 (icalendar-tests--test-import
1182 "DTSTART;VALUE=DATE:20050217
1186 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration\n"
1187 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration\n"
1188 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration\n")
1189 (icalendar-tests--test-import
1190 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
1191 DTSTAMP:20041127T183315Z
1192 LAST-MODIFIED:20041127T183329
1194 DTSTART;VALUE=DATE:20011221
1195 DTEND;VALUE=DATE:20011221
1196 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
1199 CREATED:20041127T183329
1201 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
1203 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1204 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
1206 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1207 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
1209 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
1211 (ert-deftest icalendar-import-bug-6766 ()
1212 ;;bug#6766 -- multiple byday values in a weekly rrule
1213 (icalendar-tests--test-import
1215 DTEND;TZID=America/New_York:20100421T120000
1216 DTSTAMP:20100525T141214Z
1217 DTSTART;TZID=America/New_York:20100421T113000
1218 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
1223 UID:8814e3f9-7482-408f-996c-3bfe486a1262
1227 DTSTAMP:20100525T141214Z
1228 DTSTART;VALUE=DATE:20100422
1229 DTEND;VALUE=DATE:20100423
1230 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
1232 SUMMARY:Tues + Thurs thinking
1234 UID:8814e3f9-7482-408f-996c-3bfe486a1263
1236 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1239 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1240 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1242 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1244 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1247 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1248 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1250 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1252 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1255 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1256 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1258 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1261 (ert-deftest icalendar-import-multiple-vcalendars ()
1262 (icalendar-tests--test-import
1263 "DTSTART;VALUE=DATE:20110723
1266 "&2011/7/23 event-1\n"
1267 "&23/7/2011 event-1\n"
1268 "&7/23/2011 event-1\n")
1270 (icalendar-tests--test-import
1272 PRODID:-//Emacs//NONSGML icalendar.el//EN
1273 VERSION:2.0\nBEGIN:VEVENT
1274 DTSTART;VALUE=DATE:20110723
1279 PRODID:-//Emacs//NONSGML icalendar.el//EN
1282 DTSTART;VALUE=DATE:20110724
1287 PRODID:-//Emacs//NONSGML icalendar.el//EN
1290 DTSTART;VALUE=DATE:20110725
1294 DTSTART;VALUE=DATE:20110725
1299 "&2011/7/23 event-1\n&2011/7/24 event-2\n&2011/7/25 event-3a\n&2011/7/25 event-3b\n"
1300 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
1301 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
1303 (ert-deftest icalendar-import-with-uid ()
1304 "Perform import test with uid."
1305 (icalendar-tests--test-import
1307 SUMMARY:non-recurring
1308 DTSTART;VALUE=DATE-TIME:20030919T090000
1309 DTEND;VALUE=DATE-TIME:20030919T113000"
1310 "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1311 "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1312 "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
1314 (ert-deftest icalendar-import-with-timezone ()
1315 ;; This is known to fail on MS-Windows, because the test assumes
1316 ;; Posix features of specifying DST rules.
1317 :expected-result (if (memq system-type '(windows-nt ms-dos))
1321 (icalendar-tests--test-import
1324 TZID:fictional, nonexistent, arbitrary
1326 DTSTART:20100101T000000
1329 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01
1332 DTSTART:20101201T000000
1335 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
1339 SUMMARY:standardtime
1340 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000
1341 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000
1344 SUMMARY:daylightsavingtime
1345 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000
1346 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000
1349 ;; "standardtime" begins first sunday in january and is 4 hours behind CET
1350 ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET
1351 "&2012/1/15 15:00-15:30 standardtime
1352 &2012/12/15 11:00-11:30 daylightsavingtime
1357 ;; ======================================================================
1359 ;; ======================================================================
1360 (defun icalendar-tests--test-cycle (input)
1361 "Perform cycle test.
1362 Argument INPUT icalendar event string."
1364 (if (string-match "^BEGIN:VCALENDAR" input)
1366 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
1367 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
1369 (unless (eq (char-before) ?\n)
1371 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1372 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
1373 (icalendar-import-format-summary "%s")
1374 (icalendar-import-format-location "\n Location: %s")
1375 (icalendar-import-format-description "\n Desc: %s")
1376 (icalendar-import-format-organizer "\n Organizer: %s")
1377 (icalendar-import-format-status "\n Status: %s")
1378 (icalendar-import-format-url "\n URL: %s")
1379 (icalendar-import-format-class "\n Class: %s")
1380 (icalendar-import-format-class "\n UID: %s")
1381 (icalendar-export-alarms nil))
1382 (dolist (calendar-date-style '(iso european american))
1383 (icalendar-tests--do-test-cycle)))))
1385 (defun icalendar-tests--do-test-cycle ()
1386 "Actually perform import/export cycle test."
1387 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
1388 (temp-ics (make-temp-file "icalendar-test-ics"))
1389 (org-input (buffer-substring-no-properties (point-min) (point-max))))
1394 (icalendar-import-buffer temp-diary t t)
1396 ;; step 2: export what was just imported
1398 (find-file temp-diary)
1399 (icalendar-export-region (point-min) (point-max) temp-ics))
1401 ;; compare the output of step 2 with the input of step 1
1403 (find-file temp-ics)
1404 (goto-char (point-min))
1405 ;;(when (re-search-forward "\nUID:.*\n" nil t)
1406 ;;(replace-match "\n"))
1407 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1408 (should (string= org-input cycled)))))
1410 (kill-buffer (find-buffer-visiting temp-diary))
1411 (with-current-buffer (find-buffer-visiting temp-ics)
1412 (set-buffer-modified-p nil)
1413 (kill-buffer (current-buffer)))
1414 (delete-file temp-diary)
1415 (delete-file temp-ics))))
1417 (ert-deftest icalendar-cycle ()
1418 "Perform cycling tests.
1419 Take care to avoid auto-generated UIDs here."
1420 (icalendar-tests--test-cycle
1422 DTSTART;VALUE=DATE-TIME:20030919T090000
1423 DTEND;VALUE=DATE-TIME:20030919T113000
1426 (icalendar-tests--test-cycle
1428 DTSTART;VALUE=DATE-TIME:20030919T090000
1429 DTEND;VALUE=DATE-TIME:20030919T113000
1431 DESCRIPTION:beschreibung!
1435 (icalendar-tests--test-cycle
1437 DTSTART;VALUE=DATE:19190909
1438 DTEND;VALUE=DATE:19190910
1439 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1440 SUMMARY:and diary-anniversary
1443 ;; ======================================================================
1445 ;; ======================================================================
1446 (ert-deftest icalendar-real-world ()
1447 "Perform real-world tests, as gathered from problem reports."
1448 ;; This is known to fail on MS-Windows, since it doesn't support DST
1449 ;; specification with month and day.
1450 :expected-result (if (memq system-type '(windows-nt ms-dos))
1454 (icalendar-tests--test-import
1457 PRODID:Microsoft CDO for Microsoft Exchange
1460 TZID:Kolkata, Chennai, Mumbai, New Delhi
1461 X-MICROSOFT-CDO-TZID:23
1463 DTSTART:16010101T000000
1468 DTSTART:16010101T000000
1474 DTSTAMP:20030509T043439Z
1475 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
1476 SUMMARY:On-Site Interview
1477 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
1478 010000000DB823520692542408ED02D7023F9DFF9
1479 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
1480 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
1481 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
1482 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
1483 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
1484 zz\":MAILTO:zzzzzz@zzzzzzz.com
1485 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
1487 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
1488 DESCRIPTION:10:30am - Blah
1492 CREATED:20030509T043439Z
1493 LAST-MODIFIED:20030509T043459Z
1496 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1497 X-MICROSOFT-CDO-INSTTYPE:0
1498 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1499 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1500 X-MICROSOFT-CDO-IMPORTANCE:1
1501 X-MICROSOFT-CDO-OWNERAPPTID:126441427
1504 DESCRIPTION:REMINDER
1505 TRIGGER;RELATED=START:-PT00H15M00S
1510 "&9/5/2003 07:00-12:00 On-Site Interview
1511 Desc: 10:30am - Blah
1513 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1515 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1517 "&5/9/2003 07:00-12:00 On-Site Interview
1518 Desc: 10:30am - Blah
1520 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1522 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1525 ;; created with http://apps.marudot.com/ical/
1526 (icalendar-tests--test-import
1529 PRODID:-//www.marudot.com//iCal Event Maker
1534 TZURL:http://tzurl.org/zoneinfo-outlook/Asia/Tehran
1535 X-LIC-LOCATION:Asia/Tehran
1540 DTSTART:19700101T000000
1544 DTSTAMP:20141116T171439Z
1545 UID:20141116T171439Z-678877132@marudot.com
1546 DTSTART;TZID=\"Asia/Tehran\":20141116T070000
1547 DTEND;TZID=\"Asia/Tehran\":20141116T080000
1549 DESCRIPTION:Test event from timezone without DST
1554 "&16/11/2014 04:30-05:30 NoDST
1555 Desc: Test event from timezone without DST
1556 Location: Everywhere
1557 UID: 20141116T171439Z-678877132@marudot.com
1559 "&11/16/2014 04:30-05:30 NoDST
1560 Desc: Test event from timezone without DST
1561 Location: Everywhere
1562 UID: 20141116T171439Z-678877132@marudot.com
1567 (icalendar-tests--test-import
1568 "DTSTAMP:20030618T195512Z
1569 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
1570 SUMMARY:Dress Rehearsal for XXXX-XXXX
1571 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1572 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1573 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
1574 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
1575 ORGANIZER;CN=\"ABCD,TECHTRAINING
1576 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
1577 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
1578 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
1579 DESCRIPTION:753 Zeichen hier radiert
1583 CREATED:20030618T195518Z
1584 LAST-MODIFIED:20030618T195527Z
1587 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1588 X-MICROSOFT-CDO-INSTTYPE:0
1589 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1590 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1591 X-MICROSOFT-CDO-IMPORTANCE:1
1592 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1595 DESCRIPTION:REMINDER
1596 TRIGGER;RELATED=START:-PT00H15M00S
1599 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1600 Desc: 753 Zeichen hier radiert
1601 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1602 Organizer: MAILTO:xxx@xxxxx.com
1604 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1606 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1607 Desc: 753 Zeichen hier radiert
1608 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1609 Organizer: MAILTO:xxx@xxxxx.com
1611 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1613 ;; 2003-06-18 b -- uses timezone
1614 (icalendar-tests--test-import
1617 PRODID:Microsoft CDO for Microsoft Exchange
1620 TZID:Mountain Time (US & Canada)
1621 X-MICROSOFT-CDO-TZID:12
1623 DTSTART:16010101T020000
1626 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
1629 DTSTART:16010101T020000
1632 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
1636 DTSTAMP:20030618T230323Z
1637 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
1638 SUMMARY:Updated: Dress Rehearsal for ABC01-15
1639 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1640 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1641 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
1642 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
1643 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
1645 ORGANIZER;CN=\"ABCD,TECHTRAINING
1646 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
1647 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
1648 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
1649 DESCRIPTION:Viele Zeichen standen hier früher
1653 CREATED:20030618T230326Z
1654 LAST-MODIFIED:20030618T230335Z
1657 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1658 X-MICROSOFT-CDO-INSTTYPE:0
1659 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1660 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1661 X-MICROSOFT-CDO-IMPORTANCE:1
1662 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1665 DESCRIPTION:REMINDER
1666 TRIGGER;RELATED=START:-PT00H15M00S
1671 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1672 Desc: Viele Zeichen standen hier früher
1673 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1674 Organizer: MAILTO:bbb@bbbbb.com
1676 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1678 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1679 Desc: Viele Zeichen standen hier früher
1680 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1681 Organizer: MAILTO:bbb@bbbbb.com
1683 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1685 ;; export 2004-10-28 block entries
1686 (icalendar-tests--test-export
1689 "-*- mode: text; fill-column: 256;-*-
1693 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1695 "DTSTART;VALUE=DATE:20041108
1696 DTEND;VALUE=DATE:20041111
1697 SUMMARY:Nov 8-10 aa")
1699 (icalendar-tests--test-export
1702 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1703 "DTSTART;VALUE=DATE:20041213
1704 DTEND;VALUE=DATE:20041218
1705 SUMMARY:Dec 13-17 bb")
1707 (icalendar-tests--test-export
1710 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1711 "DTSTART;VALUE=DATE:20050203
1712 DTEND;VALUE=DATE:20050205
1713 SUMMARY:Feb 3-4 cc")
1715 (icalendar-tests--test-export
1718 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1719 "DTSTART;VALUE=DATE:20050424
1720 DTEND;VALUE=DATE:20050430
1721 SUMMARY:April 24-29 dd
1723 (icalendar-tests--test-export
1726 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1727 "DTSTART;VALUE=DATE:20050530
1728 DTEND;VALUE=DATE:20050602
1729 SUMMARY:may 30 - June 1: ee")
1731 (icalendar-tests--test-export
1734 "%%(diary-block 6 6 2005 6 8 2005) ff"
1735 "DTSTART;VALUE=DATE:20050606
1736 DTEND;VALUE=DATE:20050609
1739 ;; export 2004-10-28 anniversary entries
1740 (icalendar-tests--test-export
1746 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1747 "DTSTART;VALUE=DATE:19910328
1748 DTEND;VALUE=DATE:19910329
1749 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1750 SUMMARY:aa birthday (%d years old)
1753 (icalendar-tests--test-export
1756 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1757 "DTSTART;VALUE=DATE:19570517
1758 DTEND;VALUE=DATE:19570518
1759 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1760 SUMMARY:bb birthday (%d years old)")
1762 (icalendar-tests--test-export
1765 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1766 "DTSTART;VALUE=DATE:19970608
1767 DTEND;VALUE=DATE:19970609
1768 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1769 SUMMARY:cc birthday (%d years old)")
1771 (icalendar-tests--test-export
1774 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1775 "DTSTART;VALUE=DATE:19830722
1776 DTEND;VALUE=DATE:19830723
1777 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1778 SUMMARY:dd (%d years ago...!)")
1780 (icalendar-tests--test-export
1783 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1784 "DTSTART;VALUE=DATE:19880801
1785 DTEND;VALUE=DATE:19880802
1786 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1787 SUMMARY:ee birthday (%d years old)")
1789 (icalendar-tests--test-export
1792 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1793 "DTSTART;VALUE=DATE:19570921
1794 DTEND;VALUE=DATE:19570922
1795 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1796 SUMMARY:ff birthday (%d years old)")
1801 ;; export 2004-10-28 monthly, weekly entries
1803 ;; (icalendar-tests--test-export
1806 ;; >>> ------------ monthly:
1808 ;; */27/* 10:00 blah blah"
1811 (icalendar-tests--test-export
1814 ">>> ------------ my week:
1817 "DTSTART;VALUE=DATE-TIME:20000103T130000
1818 DTEND;VALUE=DATE-TIME:20000103T140000
1819 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1822 (icalendar-tests--test-export
1826 "DTSTART;VALUE=DATE-TIME:20000103T150000
1827 DTEND;VALUE=DATE-TIME:20000103T160000
1828 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1832 (icalendar-tests--test-export
1835 "Monday 16:00-17:00 a2"
1836 "DTSTART;VALUE=DATE-TIME:20000103T160000
1837 DTEND;VALUE=DATE-TIME:20000103T170000
1838 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1841 (icalendar-tests--test-export
1844 "Tuesday 11:30-13:00 a3"
1845 "DTSTART;VALUE=DATE-TIME:20000104T113000
1846 DTEND;VALUE=DATE-TIME:20000104T130000
1847 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1850 (icalendar-tests--test-export
1854 "DTSTART;VALUE=DATE-TIME:20000104T150000
1855 DTEND;VALUE=DATE-TIME:20000104T160000
1856 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1859 (icalendar-tests--test-export
1862 "Wednesday 13:00 a5"
1863 "DTSTART;VALUE=DATE-TIME:20000105T130000
1864 DTEND;VALUE=DATE-TIME:20000105T140000
1865 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1868 (icalendar-tests--test-export
1871 "Wednesday 11:30-13:30 a6"
1872 "DTSTART;VALUE=DATE-TIME:20000105T113000
1873 DTEND;VALUE=DATE-TIME:20000105T133000
1874 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1877 (icalendar-tests--test-export
1880 "Wednesday 15:00 s1"
1881 "DTSTART;VALUE=DATE-TIME:20000105T150000
1882 DTEND;VALUE=DATE-TIME:20000105T160000
1883 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1887 ;; export 2004-10-28 regular entries
1888 (icalendar-tests--test-export
1892 >>> regular diary entries:
1894 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1895 "DTSTART;VALUE=DATE-TIME:20041012T140000
1896 DTEND;VALUE=DATE-TIME:20041012T150000
1897 SUMMARY:Tue: [2004-10-12] q1")
1900 (icalendar-tests--test-import
1905 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1913 X-MOZILLA-ALARM-DEFAULT-LENGTH
1931 X-MOZILLA-ALARM-DEFAULT-LENGTH
1947 X-MOZILLA-ALARM-DEFAULT-LENGTH
1963 X-MOZILLA-ALARM-DEFAULT-LENGTH
1965 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1968 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1978 :Rrrr/Cccccc ii Aaaaaaaa
1980 :Vvvvv Rrrr aaa Cccccc
1985 X-MOZILLA-ALARM-DEFAULT-LENGTH
2005 X-MOZILLA-ALARM-DEFAULT-LENGTH
2008 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
2023 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
2026 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2029 &23/11/2004 11:00-12:00 Hhhhhhhh
2032 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
2035 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
2036 Desc: Vvvvv Rrrr aaa Cccccc
2039 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
2043 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
2046 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2049 &11/23/2004 11:00-12:00 Hhhhhhhh
2052 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
2055 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
2056 Desc: Vvvvv Rrrr aaa Cccccc
2059 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
2065 (icalendar-tests--test-export
2066 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
2069 "DTSTART;VALUE=DATE:20040101
2070 DTEND;VALUE=DATE:20040105
2074 (icalendar-tests--test-export
2076 "5 11 2004 Bla Fasel"
2078 "DTSTART;VALUE=DATE:20041105
2079 DTEND;VALUE=DATE:20041106
2083 (icalendar-tests--test-export
2085 "2 Nov 2004 15:00-16:30 Zahnarzt"
2087 "DTSTART;VALUE=DATE-TIME:20041102T150000
2088 DTEND;VALUE=DATE-TIME:20041102T163000
2092 (icalendar-tests--test-import
2094 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
2114 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
2118 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2120 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
2124 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2128 (icalendar-tests--test-import
2129 "DTSTART;VALUE=DATE:20050217
2130 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
2131 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
2132 DTSTAMP:20050118T210335Z
2135 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2136 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
2137 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2138 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
2141 (icalendar-tests--test-export
2143 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
2145 "DTSTART;VALUE=DATE-TIME:20050208T160000
2146 DTEND;VALUE=DATE-TIME:20050208T164500
2147 RRULE:FREQ=DAILY;INTERVAL=7
2152 (icalendar-tests--test-export
2155 ;; FIXME: colon not allowed!
2156 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2157 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2158 "DTSTART;VALUE=DATE:19001101
2159 DTEND;VALUE=DATE:19001102
2160 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
2161 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
2165 (icalendar-tests--test-import
2168 PRODID:Microsoft Exchange Server 2007
2171 TZID:(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
2173 DTSTART:16010101T030000
2176 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
2179 DTSTART:16010101T020000
2182 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
2186 ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com
2187 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth
2188 er\":MAILTO:other.luser@foo.com
2189 DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n
2190 SUMMARY;LANGUAGE=en-US:Query
2191 DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\"
2193 DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2
2195 UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000
2196 010000000575268034ECDB649A15349B1BF240F15
2197 RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V
2198 ienna\":20120515T170000
2201 DTSTAMP:20120514T153645Z
2205 LOCATION;LANGUAGE=en-US:phone
2206 X-MICROSOFT-CDO-APPT-SEQUENCE:15
2207 X-MICROSOFT-CDO-OWNERAPPTID:1907632092
2208 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
2209 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
2210 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
2211 X-MICROSOFT-CDO-IMPORTANCE:1
2212 X-MICROSOFT-CDO-INSTTYPE:3
2215 DESCRIPTION:REMINDER
2216 TRIGGER;RELATED=START:-PT15M
2221 "&15/5/2012 15:00-15:30 Query
2223 Organizer: MAILTO:a.luser@foo.com
2226 UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15
2229 ;; 2015-12-05, mixed line endings and empty lines, see Bug#22092.
2230 (icalendar-tests--test-import
2232 PRODID:-//www.norwegian.no//iCalendar MIMEDIR//EN\r
2237 SEQUENCE:1512040950\r
2238 DTSTAMP:20141204T095043Z\r
2239 ORGANIZER:noreply@norwegian.no\r
2240 DTSTART:20141208T173000Z\r
2242 DTEND:20141208T215500Z\r
2244 LOCATION:Stavanger-Sola\r
2246 DESCRIPTION:Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390\r
2248 X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"><html><head><META NAME=\"Generator\" CONTENT=\"MS Exchange Server version 08.00.0681.000\"><title></title></head><body><b><font face=\"Calibri\" size=\"3\">Reisereferanse</p></body></html>
2249 SUMMARY:Norwegian til Tromsoe-Langnes -\r
2251 CATEGORIES:Appointment\r
2262 "&2014/12/8 18:30-22:55 Norwegian til Tromsoe-Langnes -
2263 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390
2264 Location: Stavanger-Sola
2265 Organizer: noreply@norwegian.no
2269 "&8/12/2014 18:30-22:55 Norwegian til Tromsoe-Langnes -
2270 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390
2271 Location: Stavanger-Sola
2272 Organizer: noreply@norwegian.no
2276 "&12/8/2014 18:30-22:55 Norwegian til Tromsoe-Langnes -
2277 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390
2278 Location: Stavanger-Sola
2279 Organizer: noreply@norwegian.no
2286 (provide 'icalendar-tests)
2287 ;;; icalendar-tests.el ends here