1 ;; icalendar-tests.el --- Test suite for icalendar.el
3 ;; Copyright (C) 2005, 2008-2014 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.
37 ;; ======================================================================
39 ;; ======================================================================
41 (defun icalendar-tests--get-ical-event (ical-string)
42 "Return iCalendar event for ICAL-STRING."
46 (goto-char (point-min))
47 (car (icalendar--read-element nil nil
)))))
49 (defun icalendar-tests--trim (string)
50 "Remove leading and trailing whitespace from STRING."
51 (replace-regexp-in-string "[ \t\n]+\\'" ""
52 (replace-regexp-in-string "\\`[ \t\n]+" "" string
)))
54 ;; ======================================================================
56 ;; ======================================================================
58 (ert-deftest icalendar--create-uid
()
59 "Test for `icalendar--create-uid'."
60 (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"))
68 (fset 't-ct
(symbol-function 'current-time
))
71 (fset 'current-time
(lambda () '(1 2 3)))
72 (should (= 77 icalendar--uid-count
))
73 (should (string= (concat "xxx-123-77-" hash
"-" username
"-19640630")
74 (icalendar--create-uid entry-full contents
)))
75 (should (= 78 icalendar--uid-count
)))
76 ;; restore 'current-time
77 (fset 'current-time
(symbol-function 't-ct
)))
78 (setq contents
"blahblah")
79 (setq icalendar-uid-format
"yyy%syyy")
80 (should (string= (concat "yyyDTSTARTyyy")
81 (icalendar--create-uid entry-full contents
)))))
83 (ert-deftest icalendar-convert-anniversary-to-ical
()
84 "Test method for `icalendar--convert-anniversary-to-ical'."
85 (let* ((calendar-date-style 'iso
)
87 (setq result
(icalendar--convert-anniversary-to-ical
88 "" "%%(diary-anniversary 1964 6 30) g"))
89 (should (consp result
))
90 (should (string= (concat
91 "\nDTSTART;VALUE=DATE:19640630"
92 "\nDTEND;VALUE=DATE:19640701"
93 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
95 (should (string= "g" (cdr result
)))))
97 (ert-deftest icalendar--convert-cyclic-to-ical
()
98 "Test method for `icalendar--convert-cyclic-to-ical'."
99 (let* ((calendar-date-style 'iso
)
101 (setq result
(icalendar--convert-block-to-ical
102 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
103 (should (consp result
))
104 (should (string= (concat
105 "\nDTSTART;VALUE=DATE:20040719"
106 "\nDTEND;VALUE=DATE:20040828")
108 (should (string= "Sommerferien" (cdr result
)))))
110 (ert-deftest icalendar--convert-block-to-ical
()
111 "Test method for `icalendar--convert-block-to-ical'."
112 (let* ((calendar-date-style 'iso
)
114 (setq result
(icalendar--convert-block-to-ical
115 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
116 (should (consp result
))
117 (should (string= (concat
118 "\nDTSTART;VALUE=DATE:20040719"
119 "\nDTEND;VALUE=DATE:20040828")
121 (should (string= "Sommerferien" (cdr result
)))))
123 (ert-deftest icalendar--convert-yearly-to-ical
()
124 "Test method for `icalendar--convert-yearly-to-ical'."
125 (let* ((calendar-date-style 'iso
)
127 (calendar-month-name-array
128 ["January" "February" "March" "April" "May" "June" "July" "August"
129 "September" "October" "November" "December"]))
130 (setq result
(icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
131 (should (consp result
))
132 (should (string= (concat
133 "\nDTSTART;VALUE=DATE:19000501"
134 "\nDTEND;VALUE=DATE:19000502"
135 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
137 (should (string= "Tag der Arbeit" (cdr result
)))))
139 (ert-deftest icalendar--convert-weekly-to-ical
()
140 "Test method for `icalendar--convert-weekly-to-ical'."
141 (let* ((calendar-date-style 'iso
)
143 (calendar-day-name-array
144 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
146 (setq result
(icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
147 (should (consp result
))
148 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
149 "\nDTEND;VALUE=DATE-TIME:20050103T093000"
150 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
152 (should (string= "subject" (cdr result
)))))
154 (ert-deftest icalendar--convert-sexp-to-ical
()
155 "Test method for `icalendar--convert-sexp-to-ical'."
157 (icalendar-export-sexp-enumeration-days 3))
158 ;; test case %%(diary-hebrew-date)
159 (setq result
(icalendar--convert-sexp-to-ical "" "%%(diary-hebrew-date)"))
160 (should (consp result
))
161 (should (eq icalendar-export-sexp-enumeration-days
(length result
)))
164 (should (string-match "Hebrew date (until sunset): .*" (cdr i
))))
167 (ert-deftest icalendar--convert-to-ical
()
168 "Test method for `icalendar--convert-to-ical'."
170 (icalendar-export-sexp-enumerate-all t
)
171 (icalendar-export-sexp-enumeration-days 3)
172 (calendar-date-style 'iso
))
173 ;; test case: %%(diary-anniversary 1642 12 25) Newton
174 ;; forced enumeration not matching the actual day --> empty
175 (setq result
(icalendar--convert-sexp-to-ical
176 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
177 (encode-time 1 1 1 6 12 2014)))
178 (should (null result
))
179 ;; test case: %%(diary-anniversary 1642 12 25) Newton
180 ;; enumeration does match the actual day -->
181 (setq result
(icalendar--convert-sexp-to-ical
182 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
183 (encode-time 1 1 1 24 12 2014)))
184 (should (= 1 (length result
)))
185 (should (consp (car result
)))
186 (should (string-match
187 "\nDTSTART;VALUE=DATE:20141225\nDTEND;VALUE=DATE:20141226"
189 (should (string-match "Newton's birthday" (cdr (car result
))))))
191 (ert-deftest icalendar--parse-vtimezone
()
192 "Test method for `icalendar--parse-vtimezone'."
193 (let (vtimezone result
)
194 (setq vtimezone
(icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
197 DTSTART:16010101T040000
200 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
203 DTSTART:16010101T030000
206 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
210 (setq result
(icalendar--parse-vtimezone vtimezone
))
211 (should (string= "thename" (car result
)))
212 (message (cdr result
))
213 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
215 (setq vtimezone
(icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
216 TZID:anothername\, with a comma
218 DTSTART:16010101T040000
221 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
224 DTSTART:16010101T030000
227 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
231 (setq result
(icalendar--parse-vtimezone vtimezone
))
232 (should (string= "anothername, with a comma" (car result
)))
233 (message (cdr result
))
234 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
236 ;; offsetfrom = offsetto
237 (setq vtimezone
(icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
238 TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
239 X-MICROSOFT-CDO-TZID:23
241 DTSTART:16010101T000000
246 DTSTART:16010101T000000
252 (setq result
(icalendar--parse-vtimezone vtimezone
))
253 (should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result
)))
254 (message (cdr result
))
255 (should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00"
258 (ert-deftest icalendar--convert-ordinary-to-ical
()
259 "Test method for `icalendar--convert-ordinary-to-ical'."
260 (let* ((calendar-date-style 'iso
)
263 (setq result
(icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
264 (should (consp result
))
265 (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
267 (should (string= "subject" (cdr result
)))
270 (setq result
(icalendar--convert-ordinary-to-ical
271 "&?" "&2010 2 15 12:34 s"))
272 (should (consp result
))
273 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
274 "\nDTEND;VALUE=DATE-TIME:20100215T133400")
276 (should (string= "s" (cdr result
)))
279 (setq result
(icalendar--convert-ordinary-to-ical
280 "&?" "&2010 2 15 12:34-23:45 s"))
281 (should (consp result
))
282 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
283 "\nDTEND;VALUE=DATE-TIME:20100215T234500")
285 (should (string= "s" (cdr result
)))
287 ;; with time, again -- test bug#5549
288 (setq result
(icalendar--convert-ordinary-to-ical
289 "x?" "x2010 2 15 0:34-1:45 s"))
290 (should (consp result
))
291 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
292 "\nDTEND;VALUE=DATE-TIME:20100215T014500")
294 (should (string= "s" (cdr result
)))))
296 (ert-deftest icalendar--diarytime-to-isotime
()
297 "Test method for `icalendar--diarytime-to-isotime'."
298 (should (string= "T011500"
299 (icalendar--diarytime-to-isotime "01:15" "")))
300 (should (string= "T011500"
301 (icalendar--diarytime-to-isotime "1:15" "")))
302 (should (string= "T000100"
303 (icalendar--diarytime-to-isotime "0:01" "")))
304 (should (string= "T010000"
305 (icalendar--diarytime-to-isotime "0100" "")))
306 (should (string= "T010000"
307 (icalendar--diarytime-to-isotime "0100" "am")))
308 (should (string= "T130000"
309 (icalendar--diarytime-to-isotime "0100" "pm")))
310 (should (string= "T120000"
311 (icalendar--diarytime-to-isotime "1200" "")))
312 (should (string= "T171700"
313 (icalendar--diarytime-to-isotime "17:17" "")))
314 (should (string= "T000000"
315 (icalendar--diarytime-to-isotime "1200" "am")))
316 (should (string= "T000100"
317 (icalendar--diarytime-to-isotime "1201" "am")))
318 (should (string= "T005900"
319 (icalendar--diarytime-to-isotime "1259" "am")))
320 (should (string= "T120000"
321 (icalendar--diarytime-to-isotime "1200" "pm")))
322 (should (string= "T120100"
323 (icalendar--diarytime-to-isotime "1201" "pm")))
324 (should (string= "T125900"
325 (icalendar--diarytime-to-isotime "1259" "pm")))
326 (should (string= "T150000"
327 (icalendar--diarytime-to-isotime "3" "pm"))))
329 (ert-deftest icalendar--datetime-to-diary-date
()
330 "Test method for `icalendar--datetime-to-diary-date'."
331 (let* ((datetime '(59 59 23 31 12 2008))
332 (calendar-date-style 'iso
))
333 (should (string= "2008 12 31"
334 (icalendar--datetime-to-diary-date datetime
)))
335 (setq calendar-date-style
'european
)
336 (should (string= "31 12 2008"
337 (icalendar--datetime-to-diary-date datetime
)))
338 (setq calendar-date-style
'american
)
339 (should (string= "12 31 2008"
340 (icalendar--datetime-to-diary-date datetime
)))))
342 (ert-deftest icalendar--datestring-to-isodate
()
343 "Test method for `icalendar--datestring-to-isodate'."
344 (let ((calendar-date-style 'iso
))
346 (should (string= "20080511"
347 (icalendar--datestring-to-isodate "2008 05 11")))
348 (should (string= "20080531"
349 (icalendar--datestring-to-isodate "2008 05 31")))
350 (should (string= "20080602"
351 (icalendar--datestring-to-isodate "2008 05 31" 2)))
354 (setq calendar-date-style
'european
)
355 (should (string= "20080511"
356 (icalendar--datestring-to-isodate "11 05 2008")))
357 (should (string= "20080531"
358 (icalendar--datestring-to-isodate "31 05 2008")))
359 (should (string= "20080602"
360 (icalendar--datestring-to-isodate "31 05 2008" 2)))
363 (setq calendar-date-style
'american
)
364 (should (string= "20081105"
365 (icalendar--datestring-to-isodate "11 05 2008")))
366 (should (string= "20081230"
367 (icalendar--datestring-to-isodate "12 30 2008")))
368 (should (string= "20090101"
369 (icalendar--datestring-to-isodate "12 30 2008" 2)))
372 (setq calendar-date-style nil
) ;not necessary for conversion
373 (should (string= "20081105"
374 (icalendar--datestring-to-isodate "Nov 05 2008")))
375 (should (string= "20081105"
376 (icalendar--datestring-to-isodate "05 Nov 2008")))
377 (should (string= "20081105"
378 (icalendar--datestring-to-isodate "2008 Nov 05")))))
380 (ert-deftest icalendar--first-weekday-of-year
()
381 "Test method for `icalendar-first-weekday-of-year'."
382 (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
383 (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
384 (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
385 (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
386 (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
387 (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
388 (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
389 (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
390 (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
392 (ert-deftest icalendar--import-format-sample
()
393 "Test method for `icalendar-import-format-sample'."
394 (should (string= (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
395 "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'")
396 (icalendar-import-format-sample
397 (icalendar-tests--get-ical-event "BEGIN:VEVENT
398 DTSTAMP:20030509T043439Z
399 DTSTART:20030509T103000
403 DTEND:20030509T153000
408 (ert-deftest icalendar--format-ical-event
()
409 "Test `icalendar--format-ical-event'."
410 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
411 (icalendar-import-format-summary "SUM %s")
412 (icalendar-import-format-location " LOC %s")
413 (icalendar-import-format-description " DES %s")
414 (icalendar-import-format-organizer " ORG %s")
415 (icalendar-import-format-status " STA %s")
416 (icalendar-import-format-url " URL %s")
417 (icalendar-import-format-class " CLA %s")
418 (event (icalendar-tests--get-ical-event "BEGIN:VEVENT
419 DTSTAMP:20030509T043439Z
420 DTSTART:20030509T103000
424 DTEND:20030509T153000
428 (should (string= "SUM sum DES des LOC loc ORG org"
429 (icalendar--format-ical-event event
)))
430 (setq icalendar-import-format
(lambda (&rest ignore
)
432 (should (string= "helloworld" (icalendar--format-ical-event event
)))
433 (setq icalendar-import-format
435 (format "-%s-%s-%s-%s-%s-%s-%s-"
436 (icalendar--get-event-property event
'SUMMARY
)
437 (icalendar--get-event-property event
'DESCRIPTION
)
438 (icalendar--get-event-property event
'LOCATION
)
439 (icalendar--get-event-property event
'ORGANIZER
)
440 (icalendar--get-event-property event
'STATUS
)
441 (icalendar--get-event-property event
'URL
)
442 (icalendar--get-event-property event
'CLASS
))))
443 (should (string= "-sum-des-loc-org-nil-nil-nil-"
444 (icalendar--format-ical-event event
)))))
446 (ert-deftest icalendar--parse-summary-and-rest
()
447 "Test `icalendar--parse-summary-and-rest'."
448 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
449 (icalendar-import-format-summary "SUM %s")
450 (icalendar-import-format-location " LOC %s")
451 (icalendar-import-format-description " DES %s")
452 (icalendar-import-format-organizer " ORG %s")
453 (icalendar-import-format-status " STA %s")
454 (icalendar-import-format-url " URL %s")
455 (icalendar-import-format-class " CLA %s")
457 (setq result
(icalendar--parse-summary-and-rest "SUM sum ORG org"))
458 (should (string= "org" (cdr (assoc 'org result
))))
460 (setq result
(icalendar--parse-summary-and-rest
461 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
462 (should (string= "des" (cdr (assoc 'des result
))))
463 (should (string= "loc" (cdr (assoc 'loc result
))))
464 (should (string= "org" (cdr (assoc 'org result
))))
465 (should (string= "sta" (cdr (assoc 'sta result
))))
466 (should (string= "cla" (cdr (assoc 'cla result
))))
468 (setq icalendar-import-format
(lambda () "Hello world"))
469 (setq result
(icalendar--parse-summary-and-rest
471 (should (not result
))
474 (ert-deftest icalendar--decode-isodatetime
()
475 "Test `icalendar--decode-isodatetime'."
476 (let ((tz (getenv "TZ"))
480 ;; Use Eastern European Time (UTC+2, UTC+3 daylight saving)
481 (setenv "TZ" "EET-2EEST,M3.5.0/3,M10.5.0/4")
483 (message "%s" (current-time-zone (encode-time 0 0 10 1 1 2013 0)))
484 (message "%s" (current-time-zone (encode-time 0 0 10 1 8 2013 0)))
486 ;; testcase: no time zone in input -> keep time as is
488 (should (equal '(0 0 10 1 1 2013 2 nil
7200)
489 (icalendar--decode-isodatetime "20130101T100000")))
490 ;; 1 Aug 2013 10:00 (DST)
491 (should (equal '(0 0 10 1 8 2013 4 t
10800)
492 (icalendar--decode-isodatetime "20130801T100000")))
494 ;; testcase: UTC time zone specifier in input -> convert to local time
495 ;; 31 Dec 2013 23:00 UTC -> 1 Jan 2013 01:00 EET
496 (should (equal '(0 0 1 1 1 2014 3 nil
7200)
497 (icalendar--decode-isodatetime "20131231T230000Z")))
498 ;; 1 Aug 2013 10:00 UTC -> 1 Aug 2013 13:00 EEST
499 (should (equal '(0 0 13 1 8 2013 4 t
10800)
500 (icalendar--decode-isodatetime "20130801T100000Z")))
503 ;; restore time-zone even if something went terribly wrong
506 ;; ======================================================================
508 ;; ======================================================================
510 (defun icalendar-tests--test-export (input-iso input-european input-american
511 expected-output
&optional alarms
)
512 "Perform an export test.
513 Argument INPUT-ISO iso style diary string.
514 Argument INPUT-EUROPEAN european style diary string.
515 Argument INPUT-AMERICAN american style diary string.
516 Argument EXPECTED-OUTPUT expected iCalendar result string.
517 Optional argument ALARMS the value of `icalendar-export-alarms' for this test.
519 European style input data must use german month names. American
520 and ISO style input data must use english month names."
521 (let ((tz (getenv "TZ"))
522 (calendar-date-style 'iso
)
523 (icalendar-recurring-start-year 2000)
524 (icalendar-export-alarms alarms
))
527 ;;; (message "Current time zone: %s" (current-time-zone))
528 ;; Use this form so as not to rely on system tz database.
529 ;; Eg hydra.nixos.org.
530 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
531 ;;; (message "Current time zone: %s" (current-time-zone))
533 (let ((calendar-month-name-array
534 ["January" "February" "March" "April" "May" "June" "July" "August"
535 "September" "October" "November" "December"])
536 (calendar-day-name-array
537 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
539 (setq calendar-date-style
'iso
)
540 (icalendar-tests--do-test-export input-iso expected-output
)))
542 (let ((calendar-month-name-array
543 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
544 "September" "Oktober" "November" "Dezember"])
545 (calendar-day-name-array
546 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
548 (setq calendar-date-style
'european
)
549 (icalendar-tests--do-test-export input-european expected-output
)))
551 (let ((calendar-month-name-array
552 ["January" "February" "March" "April" "May" "June" "July" "August"
553 "September" "October" "November" "December"])
554 (calendar-day-name-array
555 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
557 (setq calendar-date-style
'american
)
558 (icalendar-tests--do-test-export input-american expected-output
))))
559 ;; restore time-zone even if something went terribly wrong
562 (defun icalendar-tests--do-test-export (input expected-output
)
563 "Actually perform export test.
564 Argument INPUT input diary string.
565 Argument EXPECTED-OUTPUT expected iCalendar result string."
566 (let ((temp-file (make-temp-file "icalendar-tests-ics")))
571 (icalendar-export-region (point-min) (point-max) temp-file
))
573 (find-file temp-file
)
574 (goto-char (point-min))
575 (cond (expected-output
576 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
577 PRODID:-//Emacs//NONSGML icalendar.el//EN
586 (should (string-match
588 (regexp-quote (buffer-substring-no-properties
589 (match-beginning 1) (match-end 1)))
593 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
594 PRODID:-//Emacs//NONSGML icalendar.el//EN
600 (kill-buffer (find-buffer-visiting temp-file
))
601 (delete-file temp-file
))))
603 (ert-deftest icalendar-export-ordinary-no-time
()
604 "Perform export test."
606 (let ((icalendar-export-hidden-diary-entries nil
))
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 "
613 (icalendar-tests--test-export
614 "2000 Oct 3 ordinary no time "
615 "3 Okt 2000 ordinary no time "
616 "Oct 3 2000 ordinary no time "
617 "DTSTART;VALUE=DATE:20001003
618 DTEND;VALUE=DATE:20001004
619 SUMMARY:ordinary no time
622 (ert-deftest icalendar-export-ordinary
()
623 "Perform export test."
625 (icalendar-tests--test-export
626 "2000 Oct 3 16:30 ordinary with time"
627 "3 Okt 2000 16:30 ordinary with time"
628 "Oct 3 2000 16:30 ordinary with time"
629 "DTSTART;VALUE=DATE-TIME:20001003T163000
630 DTEND;VALUE=DATE-TIME:20001003T173000
631 SUMMARY:ordinary with time
633 (icalendar-tests--test-export
634 "2000 10 3 16:30 ordinary with time 2"
635 "3 10 2000 16:30 ordinary with time 2"
636 "10 3 2000 16:30 ordinary with time 2"
637 "DTSTART;VALUE=DATE-TIME:20001003T163000
638 DTEND;VALUE=DATE-TIME:20001003T173000
639 SUMMARY:ordinary with time 2
642 (icalendar-tests--test-export
643 "2000/10/3 16:30 ordinary with time 3"
644 "3/10/2000 16:30 ordinary with time 3"
645 "10/3/2000 16:30 ordinary with time 3"
646 "DTSTART;VALUE=DATE-TIME:20001003T163000
647 DTEND;VALUE=DATE-TIME:20001003T173000
648 SUMMARY:ordinary with time 3
651 (ert-deftest icalendar-export-multiline
()
652 "Perform export test."
654 ;; multiline -- FIXME!!!
655 (icalendar-tests--test-export
656 "2000 October 3 16:30 multiline
657 17:30 multiline continued FIXME"
658 "3 Oktober 2000 16:30 multiline
659 17:30 multiline continued FIXME"
660 "October 3 2000 16:30 multiline
661 17:30 multiline continued FIXME"
662 "DTSTART;VALUE=DATE-TIME:20001003T163000
663 DTEND;VALUE=DATE-TIME:20001003T173000
666 17:30 multiline continued FIXME
669 (ert-deftest icalendar-export-weekly-by-day
()
670 "Perform export test."
673 (icalendar-tests--test-export
674 "Monday 1:30pm weekly by day with start time"
675 "Montag 13:30 weekly by day with start time"
676 "Monday 1:30pm weekly by day with start time"
677 "DTSTART;VALUE=DATE-TIME:20000103T133000
678 DTEND;VALUE=DATE-TIME:20000103T143000
679 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
680 SUMMARY:weekly by day with start time
683 (icalendar-tests--test-export
684 "Monday 13:30-15:00 weekly by day with start and end time"
685 "Montag 13:30-15:00 weekly by day with start and end time"
686 "Monday 01:30pm-03:00pm weekly by day with start and end time"
687 "DTSTART;VALUE=DATE-TIME:20000103T133000
688 DTEND;VALUE=DATE-TIME:20000103T150000
689 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
690 SUMMARY:weekly by day with start and end time
693 (ert-deftest icalendar-export-yearly
()
694 "Perform export test."
696 (icalendar-tests--test-export
697 "may 1 yearly no time"
698 "1 Mai yearly no time"
699 "may 1 yearly no time"
700 "DTSTART;VALUE=DATE:19000501
701 DTEND;VALUE=DATE:19000502
702 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
703 SUMMARY:yearly no time
706 (ert-deftest icalendar-export-anniversary
()
707 "Perform export test."
709 (icalendar-tests--test-export
710 "%%(diary-anniversary 1989 10 3) anniversary no time"
711 "%%(diary-anniversary 3 10 1989) anniversary no time"
712 "%%(diary-anniversary 10 3 1989) anniversary no time"
713 "DTSTART;VALUE=DATE:19891003
714 DTEND;VALUE=DATE:19891004
715 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
716 SUMMARY:anniversary no time
718 (icalendar-tests--test-export
719 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
720 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
721 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
722 "DTSTART;VALUE=DATE-TIME:19891003T190000
723 DTEND;VALUE=DATE-TIME:19891004T200000
724 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
725 SUMMARY:anniversary with time
728 (ert-deftest icalendar-export-block
()
729 "Perform export test."
731 (icalendar-tests--test-export
732 "%%(diary-block 2001 6 18 2001 7 6) block no time"
733 "%%(diary-block 18 6 2001 6 7 2001) block no time"
734 "%%(diary-block 6 18 2001 7 6 2001) block no time"
735 "DTSTART;VALUE=DATE:20010618
736 DTEND;VALUE=DATE:20010707
737 SUMMARY:block no time
739 (icalendar-tests--test-export
740 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
741 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
742 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
743 "DTSTART;VALUE=DATE-TIME:20010618T130000
744 DTEND;VALUE=DATE-TIME:20010618T170000
745 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
746 SUMMARY:block with time
748 (icalendar-tests--test-export
749 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
750 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
751 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
752 "DTSTART;VALUE=DATE-TIME:20010618T130000
753 DTEND;VALUE=DATE-TIME:20010618T140000
754 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
755 SUMMARY:block no end time
758 (ert-deftest icalendar-export-alarms
()
759 "Perform export test with different settings for exporting alarms."
761 (icalendar-tests--test-export
762 "2014 Nov 17 19:30 no alarm"
763 "17 Nov 2014 19:30 no alarm"
764 "Nov 17 2014 19:30 no alarm"
765 "DTSTART;VALUE=DATE-TIME:20141117T193000
766 DTEND;VALUE=DATE-TIME:20141117T203000
771 ;; 10 minutes in advance, audio
772 (icalendar-tests--test-export
773 "2014 Nov 17 19:30 audio alarm"
774 "17 Nov 2014 19:30 audio alarm"
775 "Nov 17 2014 19:30 audio alarm"
776 "DTSTART;VALUE=DATE-TIME:20141117T193000
777 DTEND;VALUE=DATE-TIME:20141117T203000
786 ;; 20 minutes in advance, display
787 (icalendar-tests--test-export
788 "2014 Nov 17 19:30 display alarm"
789 "17 Nov 2014 19:30 display alarm"
790 "Nov 17 2014 19:30 display alarm"
791 "DTSTART;VALUE=DATE-TIME:20141117T193000
792 DTEND;VALUE=DATE-TIME:20141117T203000
793 SUMMARY:display alarm
797 DESCRIPTION:display alarm
802 ;; 66 minutes in advance, email
803 (icalendar-tests--test-export
804 "2014 Nov 17 19:30 email alarm"
805 "17 Nov 2014 19:30 email alarm"
806 "Nov 17 2014 19:30 email alarm"
807 "DTSTART;VALUE=DATE-TIME:20141117T193000
808 DTEND;VALUE=DATE-TIME:20141117T203000
813 DESCRIPTION:email alarm
815 ATTENDEE:MAILTO:att.one@email.com
816 ATTENDEE:MAILTO:att.two@email.com
819 '(66 ((email ("att.one@email.com" "att.two@email.com")))))
821 ;; 2 minutes in advance, all alarms
822 (icalendar-tests--test-export
823 "2014 Nov 17 19:30 all alarms"
824 "17 Nov 2014 19:30 all alarms"
825 "Nov 17 2014 19:30 all alarms"
826 "DTSTART;VALUE=DATE-TIME:20141117T193000
827 DTEND;VALUE=DATE-TIME:20141117T203000
832 DESCRIPTION:all alarms
834 ATTENDEE:MAILTO:att.one@email.com
835 ATTENDEE:MAILTO:att.two@email.com
844 DESCRIPTION:all alarms
847 '(2 ((email ("att.one@email.com" "att.two@email.com")) (audio) (display)))))
849 ;; ======================================================================
851 ;; ======================================================================
853 (defun icalendar-tests--test-import (input expected-iso expected-european
855 "Perform import test.
856 Argument INPUT icalendar event string.
857 Argument EXPECTED-ISO expected iso style diary string.
858 Argument EXPECTED-EUROPEAN expected european style diary string.
859 Argument EXPECTED-AMERICAN expected american style diary string.
860 During import test the timezone is set to Central European Time."
861 (let ((timezone (getenv "TZ")))
864 ;; Use this form so as not to rely on system tz database.
865 ;; Eg hydra.nixos.org.
866 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
868 (if (string-match "^BEGIN:VCALENDAR" input
)
870 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
871 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
873 (unless (eq (char-before) ?
\n)
875 (insert "END:VEVENT\nEND:VCALENDAR\n"))
876 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
877 (icalendar-import-format-summary "%s")
878 (icalendar-import-format-location "\n Location: %s")
879 (icalendar-import-format-description "\n Desc: %s")
880 (icalendar-import-format-organizer "\n Organizer: %s")
881 (icalendar-import-format-status "\n Status: %s")
882 (icalendar-import-format-url "\n URL: %s")
883 (icalendar-import-format-class "\n Class: %s")
884 (icalendar-import-format-uid "\n UID: %s")
887 (setq calendar-date-style
'iso
)
888 (icalendar-tests--do-test-import input expected-iso
))
889 (when expected-european
890 (setq calendar-date-style
'european
)
891 (icalendar-tests--do-test-import input expected-european
))
892 (when expected-american
893 (setq calendar-date-style
'american
)
894 (icalendar-tests--do-test-import input expected-american
)))))
895 (setenv "TZ" timezone
))))
897 (defun icalendar-tests--do-test-import (input expected-output
)
898 "Actually perform import test.
899 Argument INPUT input icalendar string.
900 Argument EXPECTED-OUTPUT expected diary string."
901 (let ((temp-file (make-temp-file "icalendar-test-diary")))
902 ;; Test the Catch-the-mysterious-coding-header logic below.
903 ;; Ruby-mode adds an after-save-hook which inserts the header!
905 ;; (find-file temp-file)
907 (icalendar-import-buffer temp-file t t
)
909 (find-file temp-file
)
910 ;; Check for the mysterious "# coding: ..." header, remove it
912 (goto-char (point-min))
913 (when (re-search-forward "# coding: .*?\n" nil t
)
914 (message (concat "%s\n"
915 "Found mysterious \"# coding ...\" header! Removing it.\n"
916 "Current Modes: %s, %s\n"
924 (buffer-disable-undo)
926 (set-buffer-modified-p nil
))
928 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
929 (should (string= expected-output result
)))
930 (kill-buffer (find-buffer-visiting temp-file
))
931 (delete-file temp-file
))))
933 (ert-deftest icalendar-import-non-recurring
()
934 "Perform standard import tests."
935 (icalendar-tests--test-import
936 "SUMMARY:non-recurring
937 DTSTART;VALUE=DATE-TIME:20030919T090000
938 DTEND;VALUE=DATE-TIME:20030919T113000"
939 "&2003/9/19 09:00-11:30 non-recurring\n"
940 "&19/9/2003 09:00-11:30 non-recurring\n"
941 "&9/19/2003 09:00-11:30 non-recurring\n")
942 (icalendar-tests--test-import
943 "SUMMARY:non-recurring allday
944 DTSTART;VALUE=DATE-TIME:20030919"
945 "&2003/9/19 non-recurring allday\n"
946 "&19/9/2003 non-recurring allday\n"
947 "&9/19/2003 non-recurring allday\n")
948 (icalendar-tests--test-import
949 ;; Checkdoc removes trailing blanks. Therefore: format!
950 (format "%s\n%s\n%s" "SUMMARY:long " " summary"
951 "DTSTART;VALUE=DATE:20030919")
952 "&2003/9/19 long summary\n"
953 "&19/9/2003 long summary\n"
954 "&9/19/2003 long summary\n")
955 (icalendar-tests--test-import
956 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
960 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
961 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
962 DTSTART;VALUE=DATE:20040719
963 DTEND;VALUE=DATE:20040828
964 DTSTAMP:20031103T011641Z
966 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
969 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
971 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
974 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
976 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
979 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
981 (icalendar-tests--test-import
983 :04979712-3902-11d9-93dd-8f9f4afe08da
990 X-MOZILLA-ALARM-DEFAULT-LENGTH
1001 "&2004/11/23 14:00-14:30 folded summary
1004 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
1005 "&23/11/2004 14:00-14:30 folded summary
1008 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
1009 "&11/23/2004 14:00-14:30 folded summary
1012 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
1014 (icalendar-tests--test-import
1016 :6161a312-3902-11d9-b512-f764153bb28b
1023 X-MOZILLA-ALARM-DEFAULT-LENGTH
1032 "&2004/11/23 14:45-15:45 another example
1035 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1036 "&23/11/2004 14:45-15:45 another example
1039 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1040 "&11/23/2004 14:45-15:45 another example
1043 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
1045 (ert-deftest icalendar-import-rrule
()
1046 (icalendar-tests--test-import
1047 "SUMMARY:rrule daily
1048 DTSTART;VALUE=DATE-TIME:20030919T090000
1049 DTEND;VALUE=DATE-TIME:20030919T113000
1052 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily\n"
1053 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily\n"
1054 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily\n")
1056 (icalendar-tests--test-import
1057 "SUMMARY:rrule daily
1058 DTSTART;VALUE=DATE-TIME:20030919T090000
1059 DTEND;VALUE=DATE-TIME:20030919T113000
1060 RRULE:FREQ=DAILY;INTERVAL=2
1062 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily\n"
1063 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily\n"
1064 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily\n")
1065 (icalendar-tests--test-import
1066 "SUMMARY:rrule daily with exceptions
1067 DTSTART;VALUE=DATE-TIME:20030919T090000
1068 DTEND;VALUE=DATE-TIME:20030919T113000
1069 RRULE:FREQ=DAILY;INTERVAL=2
1070 EXDATE:20030921,20030925
1072 "&%%(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"
1073 "&%%(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"
1074 "&%%(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")
1075 (icalendar-tests--test-import
1076 "SUMMARY:rrule weekly
1077 DTSTART;VALUE=DATE-TIME:20030919T090000
1078 DTEND;VALUE=DATE-TIME:20030919T113000
1081 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly\n"
1082 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly\n"
1083 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly\n")
1084 (icalendar-tests--test-import
1085 "SUMMARY:rrule monthly no end
1086 DTSTART;VALUE=DATE-TIME:20030919T090000
1087 DTEND;VALUE=DATE-TIME:20030919T113000
1090 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end\n"
1091 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n"
1092 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n")
1093 (icalendar-tests--test-import
1094 "SUMMARY:rrule monthly with end
1095 DTSTART;VALUE=DATE-TIME:20030919T090000
1096 DTEND;VALUE=DATE-TIME:20030919T113000
1097 RRULE:FREQ=MONTHLY;UNTIL=20050819;
1099 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end\n"
1100 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end\n"
1101 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end\n")
1102 (icalendar-tests--test-import
1103 "DTSTART;VALUE=DATE:20040815
1104 DTEND;VALUE=DATE:20040816
1105 SUMMARY:Maria Himmelfahrt
1106 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
1108 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
1109 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt\n"
1110 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt\n")
1111 (icalendar-tests--test-import
1112 "SUMMARY:rrule yearly
1113 DTSTART;VALUE=DATE-TIME:20030919T090000
1114 DTEND;VALUE=DATE-TIME:20030919T113000
1115 RRULE:FREQ=YEARLY;INTERVAL=2
1117 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly\n" ;FIXME
1118 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly\n" ;FIXME
1119 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly\n") ;FIXME
1120 (icalendar-tests--test-import
1121 "SUMMARY:rrule count daily short
1122 DTSTART;VALUE=DATE-TIME:20030919T090000
1123 DTEND;VALUE=DATE-TIME:20030919T113000
1124 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
1126 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short\n"
1127 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short\n"
1128 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short\n")
1129 (icalendar-tests--test-import
1130 "SUMMARY:rrule count daily long
1131 DTSTART;VALUE=DATE-TIME:20030919T090000
1132 DTEND;VALUE=DATE-TIME:20030919T113000
1133 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
1135 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long\n"
1136 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long\n"
1137 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long\n")
1138 (icalendar-tests--test-import
1139 "SUMMARY:rrule count bi-weekly 3 times
1140 DTSTART;VALUE=DATE-TIME:20030919T090000
1141 DTEND;VALUE=DATE-TIME:20030919T113000
1142 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
1144 "&%%(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"
1145 "&%%(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"
1146 "&%%(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")
1147 (icalendar-tests--test-import
1148 "SUMMARY:rrule count monthly
1149 DTSTART;VALUE=DATE-TIME:20030919T090000
1150 DTEND;VALUE=DATE-TIME:20030919T113000
1151 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
1153 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly\n"
1154 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly\n"
1155 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly\n")
1156 (icalendar-tests--test-import
1157 "SUMMARY:rrule count every second month
1158 DTSTART;VALUE=DATE-TIME:20030919T090000
1159 DTEND;VALUE=DATE-TIME:20030919T113000
1160 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
1162 "&%%(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
1163 "&%%(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
1164 "&%%(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
1165 (icalendar-tests--test-import
1166 "SUMMARY:rrule count yearly
1167 DTSTART;VALUE=DATE-TIME:20030919T090000
1168 DTEND;VALUE=DATE-TIME:20030919T113000
1169 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
1171 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly\n"
1172 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly\n"
1173 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly\n")
1174 (icalendar-tests--test-import
1175 "SUMMARY:rrule count every second year
1176 DTSTART;VALUE=DATE-TIME:20030919T090000
1177 DTEND;VALUE=DATE-TIME:20030919T113000
1178 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
1180 "&%%(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!!!
1181 "&%%(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!!!
1182 "&%%(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!!!
1185 (ert-deftest icalendar-import-duration
()
1187 (icalendar-tests--test-import
1188 "DTSTART;VALUE=DATE:20050217
1192 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration\n"
1193 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration\n"
1194 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration\n")
1195 (icalendar-tests--test-import
1196 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
1197 DTSTAMP:20041127T183315Z
1198 LAST-MODIFIED:20041127T183329
1200 DTSTART;VALUE=DATE:20011221
1201 DTEND;VALUE=DATE:20011221
1202 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
1205 CREATED:20041127T183329
1207 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
1209 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1210 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
1212 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1213 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
1215 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
1217 (ert-deftest icalendar-import-bug-6766
()
1218 ;;bug#6766 -- multiple byday values in a weekly rrule
1219 (icalendar-tests--test-import
1221 DTEND;TZID=America/New_York:20100421T120000
1222 DTSTAMP:20100525T141214Z
1223 DTSTART;TZID=America/New_York:20100421T113000
1224 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
1229 UID:8814e3f9-7482-408f-996c-3bfe486a1262
1233 DTSTAMP:20100525T141214Z
1234 DTSTART;VALUE=DATE:20100422
1235 DTEND;VALUE=DATE:20100423
1236 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
1238 SUMMARY:Tues + Thurs thinking
1240 UID:8814e3f9-7482-408f-996c-3bfe486a1263
1242 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1245 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1246 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1248 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1250 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1253 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1254 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1256 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1258 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1261 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1262 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1264 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1267 (ert-deftest icalendar-import-multiple-vcalendars
()
1268 (icalendar-tests--test-import
1269 "DTSTART;VALUE=DATE:20110723
1272 "&2011/7/23 event-1\n"
1273 "&23/7/2011 event-1\n"
1274 "&7/23/2011 event-1\n")
1276 (icalendar-tests--test-import
1278 PRODID:-//Emacs//NONSGML icalendar.el//EN
1279 VERSION:2.0\nBEGIN:VEVENT
1280 DTSTART;VALUE=DATE:20110723
1285 PRODID:-//Emacs//NONSGML icalendar.el//EN
1288 DTSTART;VALUE=DATE:20110724
1293 PRODID:-//Emacs//NONSGML icalendar.el//EN
1296 DTSTART;VALUE=DATE:20110725
1300 DTSTART;VALUE=DATE:20110725
1305 "&2011/7/23 event-1\n&2011/7/24 event-2\n&2011/7/25 event-3a\n&2011/7/25 event-3b\n"
1306 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
1307 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
1309 (ert-deftest icalendar-import-with-uid
()
1310 "Perform import test with uid."
1311 (icalendar-tests--test-import
1313 SUMMARY:non-recurring
1314 DTSTART;VALUE=DATE-TIME:20030919T090000
1315 DTEND;VALUE=DATE-TIME:20030919T113000"
1316 "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1317 "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1318 "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
1320 (ert-deftest icalendar-import-with-timezone
()
1322 (icalendar-tests--test-import
1325 TZID:fictional\, nonexistent\, arbitrary
1327 DTSTART:20100101T000000
1330 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01
1333 DTSTART:20101201T000000
1336 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
1340 SUMMARY:standardtime
1341 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000
1342 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000
1345 SUMMARY:daylightsavingtime
1346 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000
1347 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000
1350 ;; "standardtime" begins first sunday in january and is 4 hours behind CET
1351 ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET
1352 "&2012/1/15 15:00-15:30 standardtime
1353 &2012/12/15 11:00-11:30 daylightsavingtime
1358 ;; ======================================================================
1360 ;; ======================================================================
1361 (defun icalendar-tests--test-cycle (input)
1362 "Perform cycle test.
1363 Argument INPUT icalendar event string."
1365 (if (string-match "^BEGIN:VCALENDAR" input
)
1367 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
1368 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
1370 (unless (eq (char-before) ?
\n)
1372 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1373 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
1374 (icalendar-import-format-summary "%s")
1375 (icalendar-import-format-location "\n Location: %s")
1376 (icalendar-import-format-description "\n Desc: %s")
1377 (icalendar-import-format-organizer "\n Organizer: %s")
1378 (icalendar-import-format-status "\n Status: %s")
1379 (icalendar-import-format-url "\n URL: %s")
1380 (icalendar-import-format-class "\n Class: %s")
1381 (icalendar-import-format-class "\n UID: %s")
1382 (icalendar-export-alarms nil
))
1383 (dolist (calendar-date-style '(iso european american
))
1384 (icalendar-tests--do-test-cycle)))))
1386 (defun icalendar-tests--do-test-cycle ()
1387 "Actually perform import/export cycle test."
1388 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
1389 (temp-ics (make-temp-file "icalendar-test-ics"))
1390 (org-input (buffer-substring-no-properties (point-min) (point-max))))
1395 (icalendar-import-buffer temp-diary t t
)
1397 ;; step 2: export what was just imported
1399 (find-file temp-diary
)
1400 (icalendar-export-region (point-min) (point-max) temp-ics
))
1402 ;; compare the output of step 2 with the input of step 1
1404 (find-file temp-ics
)
1405 (goto-char (point-min))
1406 ;;(when (re-search-forward "\nUID:.*\n" nil t)
1407 ;;(replace-match "\n"))
1408 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1409 (should (string= org-input cycled
)))))
1411 (kill-buffer (find-buffer-visiting temp-diary
))
1412 (with-current-buffer (find-buffer-visiting temp-ics
)
1413 (set-buffer-modified-p nil
)
1414 (kill-buffer (current-buffer)))
1415 (delete-file temp-diary
)
1416 (delete-file temp-ics
))))
1418 (ert-deftest icalendar-cycle
()
1419 "Perform cycling tests.
1420 Take care to avoid auto-generated UIDs here."
1421 (icalendar-tests--test-cycle
1423 DTSTART;VALUE=DATE-TIME:20030919T090000
1424 DTEND;VALUE=DATE-TIME:20030919T113000
1427 (icalendar-tests--test-cycle
1429 DTSTART;VALUE=DATE-TIME:20030919T090000
1430 DTEND;VALUE=DATE-TIME:20030919T113000
1432 DESCRIPTION:beschreibung!
1436 (icalendar-tests--test-cycle
1438 DTSTART;VALUE=DATE:19190909
1439 DTEND;VALUE=DATE:19190910
1440 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1441 SUMMARY:and diary-anniversary
1444 ;; ======================================================================
1446 ;; ======================================================================
1447 (ert-deftest icalendar-real-world
()
1448 "Perform real-world tests, as gathered from problem reports."
1450 (icalendar-tests--test-import
1453 PRODID:Microsoft CDO for Microsoft Exchange
1456 TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
1457 X-MICROSOFT-CDO-TZID:23
1459 DTSTART:16010101T000000
1464 DTSTART:16010101T000000
1470 DTSTAMP:20030509T043439Z
1471 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
1472 SUMMARY:On-Site Interview
1473 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
1474 010000000DB823520692542408ED02D7023F9DFF9
1475 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
1476 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
1477 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
1478 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
1479 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
1480 zz\":MAILTO:zzzzzz@zzzzzzz.com
1481 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
1483 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
1484 DESCRIPTION:10:30am - Blah
1488 CREATED:20030509T043439Z
1489 LAST-MODIFIED:20030509T043459Z
1492 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1493 X-MICROSOFT-CDO-INSTTYPE:0
1494 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1495 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1496 X-MICROSOFT-CDO-IMPORTANCE:1
1497 X-MICROSOFT-CDO-OWNERAPPTID:126441427
1500 DESCRIPTION:REMINDER
1501 TRIGGER;RELATED=START:-PT00H15M00S
1506 "&9/5/2003 07:00-12:00 On-Site Interview
1507 Desc: 10:30am - Blah
1509 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1511 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1513 "&5/9/2003 07:00-12:00 On-Site Interview
1514 Desc: 10:30am - Blah
1516 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1518 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1521 ;; created with http://apps.marudot.com/ical/
1522 (icalendar-tests--test-import
1525 PRODID:-//www.marudot.com//iCal Event Maker
1530 TZURL:http://tzurl.org/zoneinfo-outlook/Asia/Tehran
1531 X-LIC-LOCATION:Asia/Tehran
1536 DTSTART:19700101T000000
1540 DTSTAMP:20141116T171439Z
1541 UID:20141116T171439Z-678877132@marudot.com
1542 DTSTART;TZID=\"Asia/Tehran\":20141116T070000
1543 DTEND;TZID=\"Asia/Tehran\":20141116T080000
1545 DESCRIPTION:Test event from timezone without DST
1550 "&16/11/2014 04:30-05:30 NoDST
1551 Desc: Test event from timezone without DST
1552 Location: Everywhere
1553 UID: 20141116T171439Z-678877132@marudot.com
1555 "&11/16/2014 04:30-05:30 NoDST
1556 Desc: Test event from timezone without DST
1557 Location: Everywhere
1558 UID: 20141116T171439Z-678877132@marudot.com
1563 (icalendar-tests--test-import
1564 "DTSTAMP:20030618T195512Z
1565 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
1566 SUMMARY:Dress Rehearsal for XXXX-XXXX
1567 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1568 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1569 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
1570 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
1571 ORGANIZER;CN=\"ABCD,TECHTRAINING
1572 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
1573 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
1574 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
1575 DESCRIPTION:753 Zeichen hier radiert
1579 CREATED:20030618T195518Z
1580 LAST-MODIFIED:20030618T195527Z
1583 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1584 X-MICROSOFT-CDO-INSTTYPE:0
1585 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1586 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1587 X-MICROSOFT-CDO-IMPORTANCE:1
1588 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1591 DESCRIPTION:REMINDER
1592 TRIGGER;RELATED=START:-PT00H15M00S
1595 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1596 Desc: 753 Zeichen hier radiert
1597 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1598 Organizer: MAILTO:xxx@xxxxx.com
1600 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1602 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1603 Desc: 753 Zeichen hier radiert
1604 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1605 Organizer: MAILTO:xxx@xxxxx.com
1607 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1609 ;; 2003-06-18 b -- uses timezone
1610 (icalendar-tests--test-import
1613 PRODID:Microsoft CDO for Microsoft Exchange
1616 TZID:Mountain Time (US & Canada)
1617 X-MICROSOFT-CDO-TZID:12
1619 DTSTART:16010101T020000
1622 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
1625 DTSTART:16010101T020000
1628 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
1632 DTSTAMP:20030618T230323Z
1633 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
1634 SUMMARY:Updated: Dress Rehearsal for ABC01-15
1635 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1636 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1637 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
1638 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
1639 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
1641 ORGANIZER;CN=\"ABCD,TECHTRAINING
1642 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
1643 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
1644 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
1645 DESCRIPTION:Viele Zeichen standen hier früher
1649 CREATED:20030618T230326Z
1650 LAST-MODIFIED:20030618T230335Z
1653 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1654 X-MICROSOFT-CDO-INSTTYPE:0
1655 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1656 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1657 X-MICROSOFT-CDO-IMPORTANCE:1
1658 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1661 DESCRIPTION:REMINDER
1662 TRIGGER;RELATED=START:-PT00H15M00S
1667 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1668 Desc: Viele Zeichen standen hier früher
1669 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1670 Organizer: MAILTO:bbb@bbbbb.com
1672 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1674 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1675 Desc: Viele Zeichen standen hier früher
1676 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1677 Organizer: MAILTO:bbb@bbbbb.com
1679 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1681 ;; export 2004-10-28 block entries
1682 (icalendar-tests--test-export
1685 "-*- mode: text; fill-column: 256;-*-
1689 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1691 "DTSTART;VALUE=DATE:20041108
1692 DTEND;VALUE=DATE:20041111
1693 SUMMARY:Nov 8-10 aa")
1695 (icalendar-tests--test-export
1698 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1699 "DTSTART;VALUE=DATE:20041213
1700 DTEND;VALUE=DATE:20041218
1701 SUMMARY:Dec 13-17 bb")
1703 (icalendar-tests--test-export
1706 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1707 "DTSTART;VALUE=DATE:20050203
1708 DTEND;VALUE=DATE:20050205
1709 SUMMARY:Feb 3-4 cc")
1711 (icalendar-tests--test-export
1714 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1715 "DTSTART;VALUE=DATE:20050424
1716 DTEND;VALUE=DATE:20050430
1717 SUMMARY:April 24-29 dd
1719 (icalendar-tests--test-export
1722 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1723 "DTSTART;VALUE=DATE:20050530
1724 DTEND;VALUE=DATE:20050602
1725 SUMMARY:may 30 - June 1: ee")
1727 (icalendar-tests--test-export
1730 "%%(diary-block 6 6 2005 6 8 2005) ff"
1731 "DTSTART;VALUE=DATE:20050606
1732 DTEND;VALUE=DATE:20050609
1735 ;; export 2004-10-28 anniversary entries
1736 (icalendar-tests--test-export
1742 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1743 "DTSTART;VALUE=DATE:19910328
1744 DTEND;VALUE=DATE:19910329
1745 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1746 SUMMARY:aa birthday (%d years old)
1749 (icalendar-tests--test-export
1752 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1753 "DTSTART;VALUE=DATE:19570517
1754 DTEND;VALUE=DATE:19570518
1755 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1756 SUMMARY:bb birthday (%d years old)")
1758 (icalendar-tests--test-export
1761 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1762 "DTSTART;VALUE=DATE:19970608
1763 DTEND;VALUE=DATE:19970609
1764 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1765 SUMMARY:cc birthday (%d years old)")
1767 (icalendar-tests--test-export
1770 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1771 "DTSTART;VALUE=DATE:19830722
1772 DTEND;VALUE=DATE:19830723
1773 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1774 SUMMARY:dd (%d years ago...!)")
1776 (icalendar-tests--test-export
1779 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1780 "DTSTART;VALUE=DATE:19880801
1781 DTEND;VALUE=DATE:19880802
1782 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1783 SUMMARY:ee birthday (%d years old)")
1785 (icalendar-tests--test-export
1788 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1789 "DTSTART;VALUE=DATE:19570921
1790 DTEND;VALUE=DATE:19570922
1791 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1792 SUMMARY:ff birthday (%d years old)")
1797 ;; export 2004-10-28 monthly, weekly entries
1799 ;; (icalendar-tests--test-export
1802 ;; >>> ------------ monthly:
1804 ;; */27/* 10:00 blah blah"
1807 (icalendar-tests--test-export
1810 ">>> ------------ my week:
1813 "DTSTART;VALUE=DATE-TIME:20000103T130000
1814 DTEND;VALUE=DATE-TIME:20000103T140000
1815 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1818 (icalendar-tests--test-export
1822 "DTSTART;VALUE=DATE-TIME:20000103T150000
1823 DTEND;VALUE=DATE-TIME:20000103T160000
1824 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1828 (icalendar-tests--test-export
1831 "Monday 16:00-17:00 a2"
1832 "DTSTART;VALUE=DATE-TIME:20000103T160000
1833 DTEND;VALUE=DATE-TIME:20000103T170000
1834 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1837 (icalendar-tests--test-export
1840 "Tuesday 11:30-13:00 a3"
1841 "DTSTART;VALUE=DATE-TIME:20000104T113000
1842 DTEND;VALUE=DATE-TIME:20000104T130000
1843 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1846 (icalendar-tests--test-export
1850 "DTSTART;VALUE=DATE-TIME:20000104T150000
1851 DTEND;VALUE=DATE-TIME:20000104T160000
1852 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1855 (icalendar-tests--test-export
1858 "Wednesday 13:00 a5"
1859 "DTSTART;VALUE=DATE-TIME:20000105T130000
1860 DTEND;VALUE=DATE-TIME:20000105T140000
1861 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1864 (icalendar-tests--test-export
1867 "Wednesday 11:30-13:30 a6"
1868 "DTSTART;VALUE=DATE-TIME:20000105T113000
1869 DTEND;VALUE=DATE-TIME:20000105T133000
1870 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1873 (icalendar-tests--test-export
1876 "Wednesday 15:00 s1"
1877 "DTSTART;VALUE=DATE-TIME:20000105T150000
1878 DTEND;VALUE=DATE-TIME:20000105T160000
1879 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1883 ;; export 2004-10-28 regular entries
1884 (icalendar-tests--test-export
1888 >>> regular diary entries:
1890 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1891 "DTSTART;VALUE=DATE-TIME:20041012T140000
1892 DTEND;VALUE=DATE-TIME:20041012T150000
1893 SUMMARY:Tue: [2004-10-12] q1")
1896 (icalendar-tests--test-import
1901 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1909 X-MOZILLA-ALARM-DEFAULT-LENGTH
1927 X-MOZILLA-ALARM-DEFAULT-LENGTH
1943 X-MOZILLA-ALARM-DEFAULT-LENGTH
1959 X-MOZILLA-ALARM-DEFAULT-LENGTH
1961 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1964 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1974 :Rrrr/Cccccc ii Aaaaaaaa
1976 :Vvvvv Rrrr aaa Cccccc
1981 X-MOZILLA-ALARM-DEFAULT-LENGTH
2001 X-MOZILLA-ALARM-DEFAULT-LENGTH
2004 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
2019 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
2022 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2025 &23/11/2004 11:00-12:00 Hhhhhhhh
2028 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
2031 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
2032 Desc: Vvvvv Rrrr aaa Cccccc
2035 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
2039 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
2042 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2045 &11/23/2004 11:00-12:00 Hhhhhhhh
2048 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
2051 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
2052 Desc: Vvvvv Rrrr aaa Cccccc
2055 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
2061 (icalendar-tests--test-export
2062 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
2065 "DTSTART;VALUE=DATE:20040101
2066 DTEND;VALUE=DATE:20040105
2070 (icalendar-tests--test-export
2072 "5 11 2004 Bla Fasel"
2074 "DTSTART;VALUE=DATE:20041105
2075 DTEND;VALUE=DATE:20041106
2079 (icalendar-tests--test-export
2081 "2 Nov 2004 15:00-16:30 Zahnarzt"
2083 "DTSTART;VALUE=DATE-TIME:20041102T150000
2084 DTEND;VALUE=DATE-TIME:20041102T163000
2088 (icalendar-tests--test-import
2090 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
2110 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
2114 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2116 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
2120 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2124 (icalendar-tests--test-import
2125 "DTSTART;VALUE=DATE:20050217
2126 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
2127 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
2128 DTSTAMP:20050118T210335Z
2131 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2132 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
2133 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2134 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
2137 (icalendar-tests--test-export
2139 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
2141 "DTSTART;VALUE=DATE-TIME:20050208T160000
2142 DTEND;VALUE=DATE-TIME:20050208T164500
2143 RRULE:FREQ=DAILY;INTERVAL=7
2148 (icalendar-tests--test-export
2151 ;; FIXME: colon not allowed!
2152 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2153 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2154 "DTSTART;VALUE=DATE:19001101
2155 DTEND;VALUE=DATE:19001102
2156 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
2157 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
2161 (icalendar-tests--test-import
2164 PRODID:Microsoft Exchange Server 2007
2167 TZID:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rome\, Stockholm\, Vienna
2169 DTSTART:16010101T030000
2172 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
2175 DTSTART:16010101T020000
2178 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
2182 ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com
2183 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth
2184 er\":MAILTO:other.luser@foo.com
2185 DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n
2186 SUMMARY;LANGUAGE=en-US:Query
2187 DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\"
2189 DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2
2191 UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000
2192 010000000575268034ECDB649A15349B1BF240F15
2193 RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V
2194 ienna\":20120515T170000
2197 DTSTAMP:20120514T153645Z
2201 LOCATION;LANGUAGE=en-US:phone
2202 X-MICROSOFT-CDO-APPT-SEQUENCE:15
2203 X-MICROSOFT-CDO-OWNERAPPTID:1907632092
2204 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
2205 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
2206 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
2207 X-MICROSOFT-CDO-IMPORTANCE:1
2208 X-MICROSOFT-CDO-INSTTYPE:3
2211 DESCRIPTION:REMINDER
2212 TRIGGER;RELATED=START:-PT15M
2217 "&15/5/2012 15:00-15:30 Query
2219 Organizer: MAILTO:a.luser@foo.com
2222 UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15
2226 (provide 'icalendar-tests
)
2227 ;;; icalendar-tests.el ends here