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--calendar-style ()
84 "Test for `icalendar--date-style'."
85 (dolist (calendar-date-style '(iso american european))
86 (should (eq (icalendar--date-style) calendar-date-style)))
87 (let ((cds calendar-date-style)
88 (european-calendar-style t))
89 (makunbound 'calendar-date-style)
90 (should (eq (icalendar--date-style) 'european))
91 (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME
92 (should (eq (icalendar--date-style) 'american))
93 (setq calendar-date-style cds)))
95 (ert-deftest icalendar-convert-anniversary-to-ical ()
96 "Test method for `icalendar--convert-anniversary-to-ical'."
97 (let* ((calendar-date-style 'iso)
99 (setq result (icalendar--convert-anniversary-to-ical
100 "" "%%(diary-anniversary 1964 6 30) g"))
101 (should (consp result))
102 (should (string= (concat
103 "\nDTSTART;VALUE=DATE:19640630"
104 "\nDTEND;VALUE=DATE:19640701"
105 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
107 (should (string= "g" (cdr result)))))
109 (ert-deftest icalendar--convert-cyclic-to-ical ()
110 "Test method for `icalendar--convert-cyclic-to-ical'."
111 (let* ((calendar-date-style 'iso)
113 (setq result (icalendar--convert-block-to-ical
114 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
115 (should (consp result))
116 (should (string= (concat
117 "\nDTSTART;VALUE=DATE:20040719"
118 "\nDTEND;VALUE=DATE:20040828")
120 (should (string= "Sommerferien" (cdr result)))))
122 (ert-deftest icalendar--convert-block-to-ical ()
123 "Test method for `icalendar--convert-block-to-ical'."
124 (let* ((calendar-date-style 'iso)
126 (setq result (icalendar--convert-block-to-ical
127 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
128 (should (consp result))
129 (should (string= (concat
130 "\nDTSTART;VALUE=DATE:20040719"
131 "\nDTEND;VALUE=DATE:20040828")
133 (should (string= "Sommerferien" (cdr result)))))
135 (ert-deftest icalendar--convert-yearly-to-ical ()
136 "Test method for `icalendar--convert-yearly-to-ical'."
137 (let* ((calendar-date-style 'iso)
139 (calendar-month-name-array
140 ["January" "February" "March" "April" "May" "June" "July" "August"
141 "September" "October" "November" "December"]))
142 (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
143 (should (consp result))
144 (should (string= (concat
145 "\nDTSTART;VALUE=DATE:19000501"
146 "\nDTEND;VALUE=DATE:19000502"
147 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
149 (should (string= "Tag der Arbeit" (cdr result)))))
151 (ert-deftest icalendar--convert-weekly-to-ical ()
152 "Test method for `icalendar--convert-weekly-to-ical'."
153 (let* ((calendar-date-style 'iso)
155 (calendar-day-name-array
156 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
158 (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
159 (should (consp result))
160 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
161 "\nDTEND;VALUE=DATE-TIME:20050103T093000"
162 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
164 (should (string= "subject" (cdr result)))))
166 (ert-deftest icalendar--convert-sexp-to-ical ()
167 "Test method for `icalendar--convert-sexp-to-ical'."
169 (icalendar-export-sexp-enumeration-days 3))
170 ;; test case %%(diary-hebrew-date)
171 (setq result (icalendar--convert-sexp-to-ical "" "%%(diary-hebrew-date)"))
172 (should (consp result))
173 (should (eq icalendar-export-sexp-enumeration-days (length result)))
176 (should (string-match "Hebrew date (until sunset): .*" (cdr i))))
179 (ert-deftest icalendar--convert-to-ical ()
180 "Test method for `icalendar--convert-to-ical'."
182 (icalendar-export-sexp-enumerate-all t)
183 (icalendar-export-sexp-enumeration-days 3)
184 (calendar-date-style 'iso))
185 ;; test case: %%(diary-anniversary 1642 12 25) Newton
186 ;; forced enumeration not matching the actual day --> empty
187 (setq result (icalendar--convert-sexp-to-ical
188 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
189 (encode-time 1 1 1 6 12 2014)))
190 (should (null result))
191 ;; test case: %%(diary-anniversary 1642 12 25) Newton
192 ;; enumeration does match the actual day -->
193 (setq result (icalendar--convert-sexp-to-ical
194 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
195 (encode-time 1 1 1 24 12 2014)))
196 (should (= 1 (length result)))
197 (should (consp (car result)))
198 (should (string-match
199 "\nDTSTART;VALUE=DATE:20141225\nDTEND;VALUE=DATE:20141226"
201 (should (string-match "Newton's birthday" (cdr (car result))))))
203 (ert-deftest icalendar--parse-vtimezone ()
204 "Test method for `icalendar--parse-vtimezone'."
205 (let (vtimezone result)
206 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
209 DTSTART:16010101T040000
212 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
215 DTSTART:16010101T030000
218 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
222 (setq result (icalendar--parse-vtimezone vtimezone))
223 (should (string= "thename" (car result)))
224 (message (cdr result))
225 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
227 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
228 TZID:anothername\, with a comma
230 DTSTART:16010101T040000
233 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
236 DTSTART:16010101T030000
239 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
243 (setq result (icalendar--parse-vtimezone vtimezone))
244 (should (string= "anothername, with a comma" (car result)))
245 (message (cdr result))
246 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
249 (ert-deftest icalendar--convert-ordinary-to-ical ()
250 "Test method for `icalendar--convert-ordinary-to-ical'."
251 (let* ((calendar-date-style 'iso)
254 (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
255 (should (consp result))
256 (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
258 (should (string= "subject" (cdr result)))
261 (setq result (icalendar--convert-ordinary-to-ical
262 "&?" "&2010 2 15 12:34 s"))
263 (should (consp result))
264 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
265 "\nDTEND;VALUE=DATE-TIME:20100215T133400")
267 (should (string= "s" (cdr result)))
270 (setq result (icalendar--convert-ordinary-to-ical
271 "&?" "&2010 2 15 12:34-23:45 s"))
272 (should (consp result))
273 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
274 "\nDTEND;VALUE=DATE-TIME:20100215T234500")
276 (should (string= "s" (cdr result)))
278 ;; with time, again -- test bug#5549
279 (setq result (icalendar--convert-ordinary-to-ical
280 "x?" "x2010 2 15 0:34-1:45 s"))
281 (should (consp result))
282 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
283 "\nDTEND;VALUE=DATE-TIME:20100215T014500")
285 (should (string= "s" (cdr result)))))
287 (ert-deftest icalendar--diarytime-to-isotime ()
288 "Test method for `icalendar--diarytime-to-isotime'."
289 (should (string= "T011500"
290 (icalendar--diarytime-to-isotime "01:15" "")))
291 (should (string= "T011500"
292 (icalendar--diarytime-to-isotime "1:15" "")))
293 (should (string= "T000100"
294 (icalendar--diarytime-to-isotime "0:01" "")))
295 (should (string= "T010000"
296 (icalendar--diarytime-to-isotime "0100" "")))
297 (should (string= "T010000"
298 (icalendar--diarytime-to-isotime "0100" "am")))
299 (should (string= "T130000"
300 (icalendar--diarytime-to-isotime "0100" "pm")))
301 (should (string= "T120000"
302 (icalendar--diarytime-to-isotime "1200" "")))
303 (should (string= "T171700"
304 (icalendar--diarytime-to-isotime "17:17" "")))
305 (should (string= "T000000"
306 (icalendar--diarytime-to-isotime "1200" "am")))
307 (should (string= "T000100"
308 (icalendar--diarytime-to-isotime "1201" "am")))
309 (should (string= "T005900"
310 (icalendar--diarytime-to-isotime "1259" "am")))
311 (should (string= "T120000"
312 (icalendar--diarytime-to-isotime "1200" "pm")))
313 (should (string= "T120100"
314 (icalendar--diarytime-to-isotime "1201" "pm")))
315 (should (string= "T125900"
316 (icalendar--diarytime-to-isotime "1259" "pm")))
317 (should (string= "T150000"
318 (icalendar--diarytime-to-isotime "3" "pm"))))
320 (ert-deftest icalendar--datetime-to-diary-date ()
321 "Test method for `icalendar--datetime-to-diary-date'."
322 (let* ((datetime '(59 59 23 31 12 2008))
323 (calendar-date-style 'iso))
324 (should (string= "2008 12 31"
325 (icalendar--datetime-to-diary-date datetime)))
326 (setq calendar-date-style 'european)
327 (should (string= "31 12 2008"
328 (icalendar--datetime-to-diary-date datetime)))
329 (setq calendar-date-style 'american)
330 (should (string= "12 31 2008"
331 (icalendar--datetime-to-diary-date datetime)))))
333 (ert-deftest icalendar--datestring-to-isodate ()
334 "Test method for `icalendar--datestring-to-isodate'."
335 (let ((calendar-date-style 'iso))
337 (should (string= "20080511"
338 (icalendar--datestring-to-isodate "2008 05 11")))
339 (should (string= "20080531"
340 (icalendar--datestring-to-isodate "2008 05 31")))
341 (should (string= "20080602"
342 (icalendar--datestring-to-isodate "2008 05 31" 2)))
345 (setq calendar-date-style 'european)
346 (should (string= "20080511"
347 (icalendar--datestring-to-isodate "11 05 2008")))
348 (should (string= "20080531"
349 (icalendar--datestring-to-isodate "31 05 2008")))
350 (should (string= "20080602"
351 (icalendar--datestring-to-isodate "31 05 2008" 2)))
354 (setq calendar-date-style 'american)
355 (should (string= "20081105"
356 (icalendar--datestring-to-isodate "11 05 2008")))
357 (should (string= "20081230"
358 (icalendar--datestring-to-isodate "12 30 2008")))
359 (should (string= "20090101"
360 (icalendar--datestring-to-isodate "12 30 2008" 2)))
363 (setq calendar-date-style nil) ;not necessary for conversion
364 (should (string= "20081105"
365 (icalendar--datestring-to-isodate "Nov 05 2008")))
366 (should (string= "20081105"
367 (icalendar--datestring-to-isodate "05 Nov 2008")))
368 (should (string= "20081105"
369 (icalendar--datestring-to-isodate "2008 Nov 05")))))
371 (ert-deftest icalendar--first-weekday-of-year ()
372 "Test method for `icalendar-first-weekday-of-year'."
373 (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
374 (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
375 (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
376 (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
377 (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
378 (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
379 (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
380 (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
381 (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
383 (ert-deftest icalendar--import-format-sample ()
384 "Test method for `icalendar-import-format-sample'."
385 (should (string= (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
386 "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'")
387 (icalendar-import-format-sample
388 (icalendar-tests--get-ical-event "BEGIN:VEVENT
389 DTSTAMP:20030509T043439Z
390 DTSTART:20030509T103000
394 DTEND:20030509T153000
399 (ert-deftest icalendar--format-ical-event ()
400 "Test `icalendar--format-ical-event'."
401 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
402 (icalendar-import-format-summary "SUM %s")
403 (icalendar-import-format-location " LOC %s")
404 (icalendar-import-format-description " DES %s")
405 (icalendar-import-format-organizer " ORG %s")
406 (icalendar-import-format-status " STA %s")
407 (icalendar-import-format-url " URL %s")
408 (icalendar-import-format-class " CLA %s")
409 (event (icalendar-tests--get-ical-event "BEGIN:VEVENT
410 DTSTAMP:20030509T043439Z
411 DTSTART:20030509T103000
415 DTEND:20030509T153000
419 (should (string= "SUM sum DES des LOC loc ORG org"
420 (icalendar--format-ical-event event)))
421 (setq icalendar-import-format (lambda (&rest ignore)
423 (should (string= "helloworld" (icalendar--format-ical-event event)))
424 (setq icalendar-import-format
426 (format "-%s-%s-%s-%s-%s-%s-%s-"
427 (icalendar--get-event-property event 'SUMMARY)
428 (icalendar--get-event-property event 'DESCRIPTION)
429 (icalendar--get-event-property event 'LOCATION)
430 (icalendar--get-event-property event 'ORGANIZER)
431 (icalendar--get-event-property event 'STATUS)
432 (icalendar--get-event-property event 'URL)
433 (icalendar--get-event-property event 'CLASS))))
434 (should (string= "-sum-des-loc-org-nil-nil-nil-"
435 (icalendar--format-ical-event event)))))
437 (ert-deftest icalendar--parse-summary-and-rest ()
438 "Test `icalendar--parse-summary-and-rest'."
439 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
440 (icalendar-import-format-summary "SUM %s")
441 (icalendar-import-format-location " LOC %s")
442 (icalendar-import-format-description " DES %s")
443 (icalendar-import-format-organizer " ORG %s")
444 (icalendar-import-format-status " STA %s")
445 (icalendar-import-format-url " URL %s")
446 (icalendar-import-format-class " CLA %s")
448 (setq result (icalendar--parse-summary-and-rest "SUM sum ORG org"))
449 (should (string= "org" (cdr (assoc 'org result))))
451 (setq result (icalendar--parse-summary-and-rest
452 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
453 (should (string= "des" (cdr (assoc 'des result))))
454 (should (string= "loc" (cdr (assoc 'loc result))))
455 (should (string= "org" (cdr (assoc 'org result))))
456 (should (string= "sta" (cdr (assoc 'sta result))))
457 (should (string= "cla" (cdr (assoc 'cla result))))
459 (setq icalendar-import-format (lambda () "Hello world"))
460 (setq result (icalendar--parse-summary-and-rest
462 (should (not result))
465 (ert-deftest icalendar--decode-isodatetime ()
466 "Test `icalendar--decode-isodatetime'."
467 (let ((tz (getenv "TZ"))
471 ;; Use Eastern European Time (UTC+2, UTC+3 daylight saving)
472 (setenv "TZ" "EET-2EEST,M3.5.0/3,M10.5.0/4")
474 (message "%s" (current-time-zone (encode-time 0 0 10 1 1 2013 0)))
475 (message "%s" (current-time-zone (encode-time 0 0 10 1 8 2013 0)))
477 ;; testcase: no time zone in input -> keep time as is
479 (should (equal '(0 0 10 1 1 2013 2 nil 7200)
480 (icalendar--decode-isodatetime "20130101T100000")))
481 ;; 1 Aug 2013 10:00 (DST)
482 (should (equal '(0 0 10 1 8 2013 4 t 10800)
483 (icalendar--decode-isodatetime "20130801T100000")))
485 ;; testcase: UTC time zone specifier in input -> convert to local time
486 ;; 31 Dec 2013 23:00 UTC -> 1 Jan 2013 01:00 EET
487 (should (equal '(0 0 1 1 1 2014 3 nil 7200)
488 (icalendar--decode-isodatetime "20131231T230000Z")))
489 ;; 1 Aug 2013 10:00 UTC -> 1 Aug 2013 13:00 EEST
490 (should (equal '(0 0 13 1 8 2013 4 t 10800)
491 (icalendar--decode-isodatetime "20130801T100000Z")))
494 ;; restore time-zone even if something went terribly wrong
497 ;; ======================================================================
499 ;; ======================================================================
501 (defun icalendar-tests--test-export (input-iso input-european input-american
503 "Perform an export test.
504 Argument INPUT-ISO iso style diary string.
505 Argument INPUT-EUROPEAN european style diary string.
506 Argument INPUT-AMERICAN american style diary string.
507 Argument EXPECTED-OUTPUT expected iCalendar result string.
509 European style input data must use german month names. American
510 and ISO style input data must use english month names."
511 (let ((tz (getenv "TZ"))
512 (calendar-date-style 'iso)
513 (icalendar-recurring-start-year 2000))
516 ;;; (message "Current time zone: %s" (current-time-zone))
517 ;; Use this form so as not to rely on system tz database.
518 ;; Eg hydra.nixos.org.
519 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
520 ;;; (message "Current time zone: %s" (current-time-zone))
522 (let ((calendar-month-name-array
523 ["January" "February" "March" "April" "May" "June" "July" "August"
524 "September" "October" "November" "December"])
525 (calendar-day-name-array
526 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
528 (setq calendar-date-style 'iso)
529 (icalendar-tests--do-test-export input-iso expected-output)))
531 (let ((calendar-month-name-array
532 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
533 "September" "Oktober" "November" "Dezember"])
534 (calendar-day-name-array
535 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
537 (setq calendar-date-style 'european)
538 (icalendar-tests--do-test-export input-european expected-output)))
540 (let ((calendar-month-name-array
541 ["January" "February" "March" "April" "May" "June" "July" "August"
542 "September" "October" "November" "December"])
543 (calendar-day-name-array
544 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
546 (setq calendar-date-style 'american)
547 (icalendar-tests--do-test-export input-american expected-output))))
548 ;; restore time-zone even if something went terribly wrong
551 (defun icalendar-tests--do-test-export (input expected-output)
552 "Actually perform export test.
553 Argument INPUT input diary string.
554 Argument EXPECTED-OUTPUT expected iCalendar result string."
555 (let ((temp-file (make-temp-file "icalendar-tests-ics")))
560 (icalendar-export-region (point-min) (point-max) temp-file))
562 (find-file temp-file)
563 (goto-char (point-min))
564 (cond (expected-output
565 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
566 PRODID:-//Emacs//NONSGML icalendar.el//EN
575 (should (string-match
577 (regexp-quote (buffer-substring-no-properties
578 (match-beginning 1) (match-end 1)))
582 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
583 PRODID:-//Emacs//NONSGML icalendar.el//EN
589 (kill-buffer (find-buffer-visiting temp-file))
590 (delete-file temp-file))))
592 (ert-deftest icalendar-export-ordinary-no-time ()
593 "Perform export test."
595 (let ((icalendar-export-hidden-diary-entries nil))
596 (icalendar-tests--test-export
597 "&2000 Oct 3 ordinary no time "
598 "&3 Okt 2000 ordinary no time "
599 "&Oct 3 2000 ordinary no time "
602 (icalendar-tests--test-export
603 "2000 Oct 3 ordinary no time "
604 "3 Okt 2000 ordinary no time "
605 "Oct 3 2000 ordinary no time "
606 "DTSTART;VALUE=DATE:20001003
607 DTEND;VALUE=DATE:20001004
608 SUMMARY:ordinary no time
611 (ert-deftest icalendar-export-ordinary ()
612 "Perform export test."
614 (icalendar-tests--test-export
615 "2000 Oct 3 16:30 ordinary with time"
616 "3 Okt 2000 16:30 ordinary with time"
617 "Oct 3 2000 16:30 ordinary with time"
618 "DTSTART;VALUE=DATE-TIME:20001003T163000
619 DTEND;VALUE=DATE-TIME:20001003T173000
620 SUMMARY:ordinary with time
622 (icalendar-tests--test-export
623 "2000 10 3 16:30 ordinary with time 2"
624 "3 10 2000 16:30 ordinary with time 2"
625 "10 3 2000 16:30 ordinary with time 2"
626 "DTSTART;VALUE=DATE-TIME:20001003T163000
627 DTEND;VALUE=DATE-TIME:20001003T173000
628 SUMMARY:ordinary with time 2
631 (icalendar-tests--test-export
632 "2000/10/3 16:30 ordinary with time 3"
633 "3/10/2000 16:30 ordinary with time 3"
634 "10/3/2000 16:30 ordinary with time 3"
635 "DTSTART;VALUE=DATE-TIME:20001003T163000
636 DTEND;VALUE=DATE-TIME:20001003T173000
637 SUMMARY:ordinary with time 3
640 (ert-deftest icalendar-export-multiline ()
641 "Perform export test."
643 ;; multiline -- FIXME!!!
644 (icalendar-tests--test-export
645 "2000 October 3 16:30 multiline
646 17:30 multiline continued FIXME"
647 "3 Oktober 2000 16:30 multiline
648 17:30 multiline continued FIXME"
649 "October 3 2000 16:30 multiline
650 17:30 multiline continued FIXME"
651 "DTSTART;VALUE=DATE-TIME:20001003T163000
652 DTEND;VALUE=DATE-TIME:20001003T173000
655 17:30 multiline continued FIXME
658 (ert-deftest icalendar-export-weekly-by-day ()
659 "Perform export test."
662 (icalendar-tests--test-export
663 "Monday 1:30pm weekly by day with start time"
664 "Montag 13:30 weekly by day with start time"
665 "Monday 1:30pm weekly by day with start time"
666 "DTSTART;VALUE=DATE-TIME:20000103T133000
667 DTEND;VALUE=DATE-TIME:20000103T143000
668 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
669 SUMMARY:weekly by day with start time
672 (icalendar-tests--test-export
673 "Monday 13:30-15:00 weekly by day with start and end time"
674 "Montag 13:30-15:00 weekly by day with start and end time"
675 "Monday 01:30pm-03:00pm weekly by day with start and end time"
676 "DTSTART;VALUE=DATE-TIME:20000103T133000
677 DTEND;VALUE=DATE-TIME:20000103T150000
678 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
679 SUMMARY:weekly by day with start and end time
682 (ert-deftest icalendar-export-yearly ()
683 "Perform export test."
685 (icalendar-tests--test-export
686 "may 1 yearly no time"
687 "1 Mai yearly no time"
688 "may 1 yearly no time"
689 "DTSTART;VALUE=DATE:19000501
690 DTEND;VALUE=DATE:19000502
691 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
692 SUMMARY:yearly no time
695 (ert-deftest icalendar-export-anniversary ()
696 "Perform export test."
698 (icalendar-tests--test-export
699 "%%(diary-anniversary 1989 10 3) anniversary no time"
700 "%%(diary-anniversary 3 10 1989) anniversary no time"
701 "%%(diary-anniversary 10 3 1989) anniversary no time"
702 "DTSTART;VALUE=DATE:19891003
703 DTEND;VALUE=DATE:19891004
704 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
705 SUMMARY:anniversary no time
707 (icalendar-tests--test-export
708 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
709 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
710 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
711 "DTSTART;VALUE=DATE-TIME:19891003T190000
712 DTEND;VALUE=DATE-TIME:19891004T200000
713 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
714 SUMMARY:anniversary with time
717 (ert-deftest icalendar-export-block ()
718 "Perform export test."
720 (icalendar-tests--test-export
721 "%%(diary-block 2001 6 18 2001 7 6) block no time"
722 "%%(diary-block 18 6 2001 6 7 2001) block no time"
723 "%%(diary-block 6 18 2001 7 6 2001) block no time"
724 "DTSTART;VALUE=DATE:20010618
725 DTEND;VALUE=DATE:20010707
726 SUMMARY:block no time
728 (icalendar-tests--test-export
729 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
730 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
731 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
732 "DTSTART;VALUE=DATE-TIME:20010618T130000
733 DTEND;VALUE=DATE-TIME:20010618T170000
734 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
735 SUMMARY:block with time
737 (icalendar-tests--test-export
738 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
739 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
740 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
741 "DTSTART;VALUE=DATE-TIME:20010618T130000
742 DTEND;VALUE=DATE-TIME:20010618T140000
743 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
744 SUMMARY:block no end time
747 ;; ======================================================================
749 ;; ======================================================================
751 (defun icalendar-tests--test-import (input expected-iso expected-european
753 "Perform import test.
754 Argument INPUT icalendar event string.
755 Argument EXPECTED-ISO expected iso style diary string.
756 Argument EXPECTED-EUROPEAN expected european style diary string.
757 Argument EXPECTED-AMERICAN expected american style diary string."
758 (let ((timezone (getenv "TZ")))
761 ;;; (message "Current time zone: %s" (current-time-zone))
762 ;; Use this form so as not to rely on system tz database.
763 ;; Eg hydra.nixos.org.
764 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
765 ;;; (message "Current time zone: %s" (current-time-zone))
767 (if (string-match "^BEGIN:VCALENDAR" input)
769 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
770 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
772 (unless (eq (char-before) ?\n)
774 (insert "END:VEVENT\nEND:VCALENDAR\n"))
775 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
776 (icalendar-import-format-summary "%s")
777 (icalendar-import-format-location "\n Location: %s")
778 (icalendar-import-format-description "\n Desc: %s")
779 (icalendar-import-format-organizer "\n Organizer: %s")
780 (icalendar-import-format-status "\n Status: %s")
781 (icalendar-import-format-url "\n URL: %s")
782 (icalendar-import-format-class "\n Class: %s")
783 (icalendar-import-format-uid "\n UID: %s")
786 (setq calendar-date-style 'iso)
787 (icalendar-tests--do-test-import input expected-iso))
788 (when expected-european
789 (setq calendar-date-style 'european)
790 (icalendar-tests--do-test-import input expected-european))
791 (when expected-american
792 (setq calendar-date-style 'american)
793 (icalendar-tests--do-test-import input expected-american)))))
794 (setenv "TZ" timezone))))
796 (defun icalendar-tests--do-test-import (input expected-output)
797 "Actually perform import test.
798 Argument INPUT input icalendar string.
799 Argument EXPECTED-OUTPUT expected diary string."
800 (let ((temp-file (make-temp-file "icalendar-test-diary")))
801 ;; Test the Catch-the-mysterious-coding-header logic below.
802 ;; Ruby-mode adds an after-save-hook which inserts the header!
804 ;; (find-file temp-file)
806 (icalendar-import-buffer temp-file t t)
808 (find-file temp-file)
809 ;; Check for the mysterious "# coding: ..." header, remove it
811 (goto-char (point-min))
812 (when (re-search-forward "# coding: .*?\n" nil t)
813 (message (concat "%s\n"
814 "Found mysterious \"# coding ...\" header! Removing it.\n"
815 "Current Modes: %s, %s\n"
823 (buffer-disable-undo)
825 (set-buffer-modified-p nil))
827 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
828 (should (string= expected-output result)))
829 (kill-buffer (find-buffer-visiting temp-file))
830 (delete-file temp-file))))
832 (ert-deftest icalendar-import-non-recurring ()
833 "Perform standard import tests."
834 (icalendar-tests--test-import
835 "SUMMARY:non-recurring
836 DTSTART;VALUE=DATE-TIME:20030919T090000
837 DTEND;VALUE=DATE-TIME:20030919T113000"
838 "&2003/9/19 09:00-11:30 non-recurring\n"
839 "&19/9/2003 09:00-11:30 non-recurring\n"
840 "&9/19/2003 09:00-11:30 non-recurring\n")
841 (icalendar-tests--test-import
842 "SUMMARY:non-recurring allday
843 DTSTART;VALUE=DATE-TIME:20030919"
844 "&2003/9/19 non-recurring allday\n"
845 "&19/9/2003 non-recurring allday\n"
846 "&9/19/2003 non-recurring allday\n")
847 (icalendar-tests--test-import
848 ;; Checkdoc removes trailing blanks. Therefore: format!
849 (format "%s\n%s\n%s" "SUMMARY:long " " summary"
850 "DTSTART;VALUE=DATE:20030919")
851 "&2003/9/19 long summary\n"
852 "&19/9/2003 long summary\n"
853 "&9/19/2003 long summary\n")
854 (icalendar-tests--test-import
855 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
859 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
860 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
861 DTSTART;VALUE=DATE:20040719
862 DTEND;VALUE=DATE:20040828
863 DTSTAMP:20031103T011641Z
865 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
868 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
870 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
873 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
875 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
878 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
880 (icalendar-tests--test-import
882 :04979712-3902-11d9-93dd-8f9f4afe08da
889 X-MOZILLA-ALARM-DEFAULT-LENGTH
900 "&2004/11/23 14:00-14:30 folded summary
903 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
904 "&23/11/2004 14:00-14:30 folded summary
907 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
908 "&11/23/2004 14:00-14:30 folded summary
911 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
913 (icalendar-tests--test-import
915 :6161a312-3902-11d9-b512-f764153bb28b
922 X-MOZILLA-ALARM-DEFAULT-LENGTH
931 "&2004/11/23 14:45-15:45 another example
934 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
935 "&23/11/2004 14:45-15:45 another example
938 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
939 "&11/23/2004 14:45-15:45 another example
942 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
944 (ert-deftest icalendar-import-rrule ()
945 (icalendar-tests--test-import
947 DTSTART;VALUE=DATE-TIME:20030919T090000
948 DTEND;VALUE=DATE-TIME:20030919T113000
951 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily\n"
952 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily\n"
953 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily\n")
955 (icalendar-tests--test-import
957 DTSTART;VALUE=DATE-TIME:20030919T090000
958 DTEND;VALUE=DATE-TIME:20030919T113000
959 RRULE:FREQ=DAILY;INTERVAL=2
961 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily\n"
962 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily\n"
963 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily\n")
964 (icalendar-tests--test-import
965 "SUMMARY:rrule daily with exceptions
966 DTSTART;VALUE=DATE-TIME:20030919T090000
967 DTEND;VALUE=DATE-TIME:20030919T113000
968 RRULE:FREQ=DAILY;INTERVAL=2
969 EXDATE:20030921,20030925
971 "&%%(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"
972 "&%%(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"
973 "&%%(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")
974 (icalendar-tests--test-import
975 "SUMMARY:rrule weekly
976 DTSTART;VALUE=DATE-TIME:20030919T090000
977 DTEND;VALUE=DATE-TIME:20030919T113000
980 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly\n"
981 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly\n"
982 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly\n")
983 (icalendar-tests--test-import
984 "SUMMARY:rrule monthly no end
985 DTSTART;VALUE=DATE-TIME:20030919T090000
986 DTEND;VALUE=DATE-TIME:20030919T113000
989 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end\n"
990 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n"
991 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n")
992 (icalendar-tests--test-import
993 "SUMMARY:rrule monthly with end
994 DTSTART;VALUE=DATE-TIME:20030919T090000
995 DTEND;VALUE=DATE-TIME:20030919T113000
996 RRULE:FREQ=MONTHLY;UNTIL=20050819;
998 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end\n"
999 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end\n"
1000 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end\n")
1001 (icalendar-tests--test-import
1002 "DTSTART;VALUE=DATE:20040815
1003 DTEND;VALUE=DATE:20040816
1004 SUMMARY:Maria Himmelfahrt
1005 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
1007 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
1008 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt\n"
1009 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt\n")
1010 (icalendar-tests--test-import
1011 "SUMMARY:rrule yearly
1012 DTSTART;VALUE=DATE-TIME:20030919T090000
1013 DTEND;VALUE=DATE-TIME:20030919T113000
1014 RRULE:FREQ=YEARLY;INTERVAL=2
1016 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly\n" ;FIXME
1017 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly\n" ;FIXME
1018 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly\n") ;FIXME
1019 (icalendar-tests--test-import
1020 "SUMMARY:rrule count daily short
1021 DTSTART;VALUE=DATE-TIME:20030919T090000
1022 DTEND;VALUE=DATE-TIME:20030919T113000
1023 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
1025 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short\n"
1026 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short\n"
1027 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short\n")
1028 (icalendar-tests--test-import
1029 "SUMMARY:rrule count daily long
1030 DTSTART;VALUE=DATE-TIME:20030919T090000
1031 DTEND;VALUE=DATE-TIME:20030919T113000
1032 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
1034 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long\n"
1035 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long\n"
1036 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long\n")
1037 (icalendar-tests--test-import
1038 "SUMMARY:rrule count bi-weekly 3 times
1039 DTSTART;VALUE=DATE-TIME:20030919T090000
1040 DTEND;VALUE=DATE-TIME:20030919T113000
1041 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
1043 "&%%(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"
1044 "&%%(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"
1045 "&%%(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")
1046 (icalendar-tests--test-import
1047 "SUMMARY:rrule count monthly
1048 DTSTART;VALUE=DATE-TIME:20030919T090000
1049 DTEND;VALUE=DATE-TIME:20030919T113000
1050 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
1052 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly\n"
1053 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly\n"
1054 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly\n")
1055 (icalendar-tests--test-import
1056 "SUMMARY:rrule count every second month
1057 DTSTART;VALUE=DATE-TIME:20030919T090000
1058 DTEND;VALUE=DATE-TIME:20030919T113000
1059 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
1061 "&%%(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
1062 "&%%(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
1063 "&%%(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
1064 (icalendar-tests--test-import
1065 "SUMMARY:rrule count yearly
1066 DTSTART;VALUE=DATE-TIME:20030919T090000
1067 DTEND;VALUE=DATE-TIME:20030919T113000
1068 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
1070 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly\n"
1071 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly\n"
1072 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly\n")
1073 (icalendar-tests--test-import
1074 "SUMMARY:rrule count every second year
1075 DTSTART;VALUE=DATE-TIME:20030919T090000
1076 DTEND;VALUE=DATE-TIME:20030919T113000
1077 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
1079 "&%%(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!!!
1080 "&%%(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!!!
1081 "&%%(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!!!
1084 (ert-deftest icalendar-import-duration ()
1086 (icalendar-tests--test-import
1087 "DTSTART;VALUE=DATE:20050217
1091 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration\n"
1092 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration\n"
1093 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration\n")
1094 (icalendar-tests--test-import
1095 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
1096 DTSTAMP:20041127T183315Z
1097 LAST-MODIFIED:20041127T183329
1099 DTSTART;VALUE=DATE:20011221
1100 DTEND;VALUE=DATE:20011221
1101 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
1104 CREATED:20041127T183329
1106 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
1108 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1109 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
1111 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1112 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
1114 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
1116 (ert-deftest icalendar-import-bug-6766 ()
1117 ;;bug#6766 -- multiple byday values in a weekly rrule
1118 (icalendar-tests--test-import
1120 DTEND;TZID=America/New_York:20100421T120000
1121 DTSTAMP:20100525T141214Z
1122 DTSTART;TZID=America/New_York:20100421T113000
1123 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
1128 UID:8814e3f9-7482-408f-996c-3bfe486a1262
1132 DTSTAMP:20100525T141214Z
1133 DTSTART;VALUE=DATE:20100422
1134 DTEND;VALUE=DATE:20100423
1135 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
1137 SUMMARY:Tues + Thurs thinking
1139 UID:8814e3f9-7482-408f-996c-3bfe486a1263
1141 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1144 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1145 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1147 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1149 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1152 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1153 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1155 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1157 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1160 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1161 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1163 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1166 (ert-deftest icalendar-import-multiple-vcalendars ()
1167 (icalendar-tests--test-import
1168 "DTSTART;VALUE=DATE:20110723
1171 "&2011/7/23 event-1\n"
1172 "&23/7/2011 event-1\n"
1173 "&7/23/2011 event-1\n")
1175 (icalendar-tests--test-import
1177 PRODID:-//Emacs//NONSGML icalendar.el//EN
1178 VERSION:2.0\nBEGIN:VEVENT
1179 DTSTART;VALUE=DATE:20110723
1184 PRODID:-//Emacs//NONSGML icalendar.el//EN
1187 DTSTART;VALUE=DATE:20110724
1192 PRODID:-//Emacs//NONSGML icalendar.el//EN
1195 DTSTART;VALUE=DATE:20110725
1199 DTSTART;VALUE=DATE:20110725
1204 "&2011/7/23 event-1\n&2011/7/24 event-2\n&2011/7/25 event-3a\n&2011/7/25 event-3b\n"
1205 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
1206 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
1208 (ert-deftest icalendar-import-with-uid ()
1209 "Perform import test with uid."
1210 (icalendar-tests--test-import
1212 SUMMARY:non-recurring
1213 DTSTART;VALUE=DATE-TIME:20030919T090000
1214 DTEND;VALUE=DATE-TIME:20030919T113000"
1215 "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1216 "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1217 "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
1219 (ert-deftest icalendar-import-with-timezone ()
1221 (icalendar-tests--test-import
1224 TZID:fictional\, nonexistent\, arbitrary
1226 DTSTART:20100101T000000
1229 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01
1232 DTSTART:20101201T000000
1235 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
1239 SUMMARY:standardtime
1240 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000
1241 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000
1244 SUMMARY:daylightsavingtime
1245 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000
1246 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000
1249 ;; "standardtime" begins first sunday in january and is 4 hours behind CET
1250 ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET
1251 "&2012/1/15 15:00-15:30 standardtime
1252 &2012/12/15 11:00-11:30 daylightsavingtime
1257 ;; ======================================================================
1259 ;; ======================================================================
1260 (defun icalendar-tests--test-cycle (input)
1261 "Perform cycle test.
1262 Argument INPUT icalendar event string."
1264 (if (string-match "^BEGIN:VCALENDAR" input)
1266 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
1267 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
1269 (unless (eq (char-before) ?\n)
1271 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1272 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
1273 (icalendar-import-format-summary "%s")
1274 (icalendar-import-format-location "\n Location: %s")
1275 (icalendar-import-format-description "\n Desc: %s")
1276 (icalendar-import-format-organizer "\n Organizer: %s")
1277 (icalendar-import-format-status "\n Status: %s")
1278 (icalendar-import-format-url "\n URL: %s")
1279 (icalendar-import-format-class "\n Class: %s")
1280 (icalendar-import-format-class "\n UID: %s"))
1281 (dolist (calendar-date-style '(iso european american))
1282 (icalendar-tests--do-test-cycle)))))
1284 (defun icalendar-tests--do-test-cycle ()
1285 "Actually perform import/export cycle test."
1286 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
1287 (temp-ics (make-temp-file "icalendar-test-ics"))
1288 (org-input (buffer-substring-no-properties (point-min) (point-max))))
1293 (icalendar-import-buffer temp-diary t t)
1295 ;; step 2: export what was just imported
1297 (find-file temp-diary)
1298 (icalendar-export-region (point-min) (point-max) temp-ics))
1300 ;; compare the output of step 2 with the input of step 1
1302 (find-file temp-ics)
1303 (goto-char (point-min))
1304 ;;(when (re-search-forward "\nUID:.*\n" nil t)
1305 ;;(replace-match "\n"))
1306 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1307 (should (string= org-input cycled)))))
1309 (kill-buffer (find-buffer-visiting temp-diary))
1310 (with-current-buffer (find-buffer-visiting temp-ics)
1311 (set-buffer-modified-p nil)
1312 (kill-buffer (current-buffer)))
1313 (delete-file temp-diary)
1314 (delete-file temp-ics))))
1316 (ert-deftest icalendar-cycle ()
1317 "Perform cycling tests.
1318 Take care to avoid auto-generated UIDs here."
1319 (icalendar-tests--test-cycle
1321 DTSTART;VALUE=DATE-TIME:20030919T090000
1322 DTEND;VALUE=DATE-TIME:20030919T113000
1325 (icalendar-tests--test-cycle
1327 DTSTART;VALUE=DATE-TIME:20030919T090000
1328 DTEND;VALUE=DATE-TIME:20030919T113000
1330 DESCRIPTION:beschreibung!
1334 (icalendar-tests--test-cycle
1336 DTSTART;VALUE=DATE:19190909
1337 DTEND;VALUE=DATE:19190910
1338 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1339 SUMMARY:and diary-anniversary
1342 ;; ======================================================================
1344 ;; ======================================================================
1345 (ert-deftest icalendar-real-world ()
1346 "Perform real-world tests, as gathered from problem reports."
1348 (icalendar-tests--test-import
1351 PRODID:Microsoft CDO for Microsoft Exchange
1354 TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
1355 X-MICROSOFT-CDO-TZID:23
1357 DTSTART:16010101T000000
1362 DTSTART:16010101T000000
1368 DTSTAMP:20030509T043439Z
1369 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
1370 SUMMARY:On-Site Interview
1371 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
1372 010000000DB823520692542408ED02D7023F9DFF9
1373 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
1374 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
1375 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
1376 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
1377 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
1378 zz\":MAILTO:zzzzzz@zzzzzzz.com
1379 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
1381 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
1382 DESCRIPTION:10:30am - Blah
1386 CREATED:20030509T043439Z
1387 LAST-MODIFIED:20030509T043459Z
1390 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1391 X-MICROSOFT-CDO-INSTTYPE:0
1392 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1393 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1394 X-MICROSOFT-CDO-IMPORTANCE:1
1395 X-MICROSOFT-CDO-OWNERAPPTID:126441427
1398 DESCRIPTION:REMINDER
1399 TRIGGER;RELATED=START:-PT00H15M00S
1404 "&9/5/2003 10:30-15:30 On-Site Interview
1405 Desc: 10:30am - Blah
1407 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1409 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1411 "&5/9/2003 10:30-15:30 On-Site Interview
1412 Desc: 10:30am - Blah
1414 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1416 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1420 (icalendar-tests--test-import
1421 "DTSTAMP:20030618T195512Z
1422 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
1423 SUMMARY:Dress Rehearsal for XXXX-XXXX
1424 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1425 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1426 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
1427 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
1428 ORGANIZER;CN=\"ABCD,TECHTRAINING
1429 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
1430 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
1431 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
1432 DESCRIPTION:753 Zeichen hier radiert
1436 CREATED:20030618T195518Z
1437 LAST-MODIFIED:20030618T195527Z
1440 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1441 X-MICROSOFT-CDO-INSTTYPE:0
1442 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1443 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1444 X-MICROSOFT-CDO-IMPORTANCE:1
1445 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1448 DESCRIPTION:REMINDER
1449 TRIGGER;RELATED=START:-PT00H15M00S
1452 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1453 Desc: 753 Zeichen hier radiert
1454 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1455 Organizer: MAILTO:xxx@xxxxx.com
1457 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1459 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1460 Desc: 753 Zeichen hier radiert
1461 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1462 Organizer: MAILTO:xxx@xxxxx.com
1464 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1466 ;; 2003-06-18 b -- uses timezone
1467 (icalendar-tests--test-import
1470 PRODID:Microsoft CDO for Microsoft Exchange
1473 TZID:Mountain Time (US & Canada)
1474 X-MICROSOFT-CDO-TZID:12
1476 DTSTART:16010101T020000
1479 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
1482 DTSTART:16010101T020000
1485 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
1489 DTSTAMP:20030618T230323Z
1490 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
1491 SUMMARY:Updated: Dress Rehearsal for ABC01-15
1492 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1493 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1494 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
1495 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
1496 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
1498 ORGANIZER;CN=\"ABCD,TECHTRAINING
1499 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
1500 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
1501 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
1502 DESCRIPTION:Viele Zeichen standen hier früher
1506 CREATED:20030618T230326Z
1507 LAST-MODIFIED:20030618T230335Z
1510 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1511 X-MICROSOFT-CDO-INSTTYPE:0
1512 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1513 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1514 X-MICROSOFT-CDO-IMPORTANCE:1
1515 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1518 DESCRIPTION:REMINDER
1519 TRIGGER;RELATED=START:-PT00H15M00S
1524 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1525 Desc: Viele Zeichen standen hier früher
1526 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1527 Organizer: MAILTO:bbb@bbbbb.com
1529 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1531 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1532 Desc: Viele Zeichen standen hier früher
1533 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1534 Organizer: MAILTO:bbb@bbbbb.com
1536 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1538 ;; export 2004-10-28 block entries
1539 (icalendar-tests--test-export
1542 "-*- mode: text; fill-column: 256;-*-
1546 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1548 "DTSTART;VALUE=DATE:20041108
1549 DTEND;VALUE=DATE:20041111
1550 SUMMARY:Nov 8-10 aa")
1552 (icalendar-tests--test-export
1555 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1556 "DTSTART;VALUE=DATE:20041213
1557 DTEND;VALUE=DATE:20041218
1558 SUMMARY:Dec 13-17 bb")
1560 (icalendar-tests--test-export
1563 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1564 "DTSTART;VALUE=DATE:20050203
1565 DTEND;VALUE=DATE:20050205
1566 SUMMARY:Feb 3-4 cc")
1568 (icalendar-tests--test-export
1571 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1572 "DTSTART;VALUE=DATE:20050424
1573 DTEND;VALUE=DATE:20050430
1574 SUMMARY:April 24-29 dd
1576 (icalendar-tests--test-export
1579 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1580 "DTSTART;VALUE=DATE:20050530
1581 DTEND;VALUE=DATE:20050602
1582 SUMMARY:may 30 - June 1: ee")
1584 (icalendar-tests--test-export
1587 "%%(diary-block 6 6 2005 6 8 2005) ff"
1588 "DTSTART;VALUE=DATE:20050606
1589 DTEND;VALUE=DATE:20050609
1592 ;; export 2004-10-28 anniversary entries
1593 (icalendar-tests--test-export
1599 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1600 "DTSTART;VALUE=DATE:19910328
1601 DTEND;VALUE=DATE:19910329
1602 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1603 SUMMARY:aa birthday (%d years old)
1606 (icalendar-tests--test-export
1609 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1610 "DTSTART;VALUE=DATE:19570517
1611 DTEND;VALUE=DATE:19570518
1612 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1613 SUMMARY:bb birthday (%d years old)")
1615 (icalendar-tests--test-export
1618 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1619 "DTSTART;VALUE=DATE:19970608
1620 DTEND;VALUE=DATE:19970609
1621 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1622 SUMMARY:cc birthday (%d years old)")
1624 (icalendar-tests--test-export
1627 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1628 "DTSTART;VALUE=DATE:19830722
1629 DTEND;VALUE=DATE:19830723
1630 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1631 SUMMARY:dd (%d years ago...!)")
1633 (icalendar-tests--test-export
1636 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1637 "DTSTART;VALUE=DATE:19880801
1638 DTEND;VALUE=DATE:19880802
1639 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1640 SUMMARY:ee birthday (%d years old)")
1642 (icalendar-tests--test-export
1645 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1646 "DTSTART;VALUE=DATE:19570921
1647 DTEND;VALUE=DATE:19570922
1648 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1649 SUMMARY:ff birthday (%d years old)")
1654 ;; export 2004-10-28 monthly, weekly entries
1656 ;; (icalendar-tests--test-export
1659 ;; >>> ------------ monthly:
1661 ;; */27/* 10:00 blah blah"
1664 (icalendar-tests--test-export
1667 ">>> ------------ my week:
1670 "DTSTART;VALUE=DATE-TIME:20000103T130000
1671 DTEND;VALUE=DATE-TIME:20000103T140000
1672 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1675 (icalendar-tests--test-export
1679 "DTSTART;VALUE=DATE-TIME:20000103T150000
1680 DTEND;VALUE=DATE-TIME:20000103T160000
1681 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1685 (icalendar-tests--test-export
1688 "Monday 16:00-17:00 a2"
1689 "DTSTART;VALUE=DATE-TIME:20000103T160000
1690 DTEND;VALUE=DATE-TIME:20000103T170000
1691 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1694 (icalendar-tests--test-export
1697 "Tuesday 11:30-13:00 a3"
1698 "DTSTART;VALUE=DATE-TIME:20000104T113000
1699 DTEND;VALUE=DATE-TIME:20000104T130000
1700 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1703 (icalendar-tests--test-export
1707 "DTSTART;VALUE=DATE-TIME:20000104T150000
1708 DTEND;VALUE=DATE-TIME:20000104T160000
1709 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1712 (icalendar-tests--test-export
1715 "Wednesday 13:00 a5"
1716 "DTSTART;VALUE=DATE-TIME:20000105T130000
1717 DTEND;VALUE=DATE-TIME:20000105T140000
1718 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1721 (icalendar-tests--test-export
1724 "Wednesday 11:30-13:30 a6"
1725 "DTSTART;VALUE=DATE-TIME:20000105T113000
1726 DTEND;VALUE=DATE-TIME:20000105T133000
1727 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1730 (icalendar-tests--test-export
1733 "Wednesday 15:00 s1"
1734 "DTSTART;VALUE=DATE-TIME:20000105T150000
1735 DTEND;VALUE=DATE-TIME:20000105T160000
1736 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1740 ;; export 2004-10-28 regular entries
1741 (icalendar-tests--test-export
1745 >>> regular diary entries:
1747 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1748 "DTSTART;VALUE=DATE-TIME:20041012T140000
1749 DTEND;VALUE=DATE-TIME:20041012T150000
1750 SUMMARY:Tue: [2004-10-12] q1")
1753 (icalendar-tests--test-import
1758 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1766 X-MOZILLA-ALARM-DEFAULT-LENGTH
1784 X-MOZILLA-ALARM-DEFAULT-LENGTH
1800 X-MOZILLA-ALARM-DEFAULT-LENGTH
1816 X-MOZILLA-ALARM-DEFAULT-LENGTH
1818 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1821 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1831 :Rrrr/Cccccc ii Aaaaaaaa
1833 :Vvvvv Rrrr aaa Cccccc
1838 X-MOZILLA-ALARM-DEFAULT-LENGTH
1858 X-MOZILLA-ALARM-DEFAULT-LENGTH
1861 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1876 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
1879 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1882 &23/11/2004 11:00-12:00 Hhhhhhhh
1885 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
1888 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
1889 Desc: Vvvvv Rrrr aaa Cccccc
1892 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
1896 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
1899 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1902 &11/23/2004 11:00-12:00 Hhhhhhhh
1905 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
1908 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
1909 Desc: Vvvvv Rrrr aaa Cccccc
1912 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
1918 (icalendar-tests--test-export
1919 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
1922 "DTSTART;VALUE=DATE:20040101
1923 DTEND;VALUE=DATE:20040105
1927 (icalendar-tests--test-export
1929 "5 11 2004 Bla Fasel"
1931 "DTSTART;VALUE=DATE:20041105
1932 DTEND;VALUE=DATE:20041106
1936 (icalendar-tests--test-export
1938 "2 Nov 2004 15:00-16:30 Zahnarzt"
1940 "DTSTART;VALUE=DATE-TIME:20041102T150000
1941 DTEND;VALUE=DATE-TIME:20041102T163000
1945 (icalendar-tests--test-import
1947 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
1967 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
1971 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
1973 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
1977 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
1981 (icalendar-tests--test-import
1982 "DTSTART;VALUE=DATE:20050217
1983 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
1984 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
1985 DTSTAMP:20050118T210335Z
1988 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
1989 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
1990 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
1991 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
1994 (icalendar-tests--test-export
1996 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
1998 "DTSTART;VALUE=DATE-TIME:20050208T160000
1999 DTEND;VALUE=DATE-TIME:20050208T164500
2000 RRULE:FREQ=DAILY;INTERVAL=7
2005 (icalendar-tests--test-export
2008 ;; FIXME: colon not allowed!
2009 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2010 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2011 "DTSTART;VALUE=DATE:19001101
2012 DTEND;VALUE=DATE:19001102
2013 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
2014 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
2018 (icalendar-tests--test-import
2021 PRODID:Microsoft Exchange Server 2007
2024 TZID:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rome\, Stockholm\, Vienna
2026 DTSTART:16010101T030000
2029 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
2032 DTSTART:16010101T020000
2035 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
2039 ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com
2040 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth
2041 er\":MAILTO:other.luser@foo.com
2042 DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n
2043 SUMMARY;LANGUAGE=en-US:Query
2044 DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\"
2046 DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2
2048 UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000
2049 010000000575268034ECDB649A15349B1BF240F15
2050 RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V
2051 ienna\":20120515T170000
2054 DTSTAMP:20120514T153645Z
2058 LOCATION;LANGUAGE=en-US:phone
2059 X-MICROSOFT-CDO-APPT-SEQUENCE:15
2060 X-MICROSOFT-CDO-OWNERAPPTID:1907632092
2061 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
2062 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
2063 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
2064 X-MICROSOFT-CDO-IMPORTANCE:1
2065 X-MICROSOFT-CDO-INSTTYPE:3
2068 DESCRIPTION:REMINDER
2069 TRIGGER;RELATED=START:-PT15M
2074 "&15/5/2012 15:00-15:30 Query
2076 Organizer: MAILTO:a.luser@foo.com
2079 UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15
2083 (provide 'icalendar-tests)
2084 ;;; icalendar-tests.el ends here