1 ;; icalendar-tests.el --- Test suite for icalendar.el
3 ;; Copyright (C) 2005, 2008-2016 Free Software Foundation, Inc.
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
8 ;; Human-Keywords: calendar, diary, iCalendar, vCalendar
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; - Add more unit tests for functions, timezone etc.
30 ;; Note: Watch the trailing blank that is added on import.
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")
61 (icalendar--uid-count 77)
62 (entry-full "30.06.1964 07:01 blahblah")
63 (hash (format "%d" (abs (sxhash entry-full
))))
64 (contents "DTSTART:19640630T070100\nblahblah")
65 (username (or user-login-name
"UNKNOWN_USER")))
66 (cl-letf (((symbol-function 'current-time
) (lambda () '(1 2 3))))
67 (should (= 77 icalendar--uid-count
))
68 (should (string= (concat "xxx-123-77-" hash
"-" username
"-19640630")
69 (icalendar--create-uid entry-full contents
)))
70 (should (= 78 icalendar--uid-count
)))
71 (setq contents
"blahblah")
72 (setq icalendar-uid-format
"yyy%syyy")
73 (should (string= (concat "yyyDTSTARTyyy")
74 (icalendar--create-uid entry-full contents
)))))
76 (ert-deftest icalendar-convert-anniversary-to-ical
()
77 "Test method for `icalendar--convert-anniversary-to-ical'."
78 (let* ((calendar-date-style 'iso
)
80 (setq result
(icalendar--convert-anniversary-to-ical
81 "" "%%(diary-anniversary 1964 6 30) g"))
82 (should (consp result
))
83 (should (string= (concat
84 "\nDTSTART;VALUE=DATE:19640630"
85 "\nDTEND;VALUE=DATE:19640701"
86 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
88 (should (string= "g" (cdr result
)))))
90 (ert-deftest icalendar--convert-cyclic-to-ical
()
91 "Test method for `icalendar--convert-cyclic-to-ical'."
92 (let* ((calendar-date-style 'iso
)
94 (setq result
(icalendar--convert-block-to-ical
95 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
96 (should (consp result
))
97 (should (string= (concat
98 "\nDTSTART;VALUE=DATE:20040719"
99 "\nDTEND;VALUE=DATE:20040828")
101 (should (string= "Sommerferien" (cdr result
)))))
103 (ert-deftest icalendar--convert-block-to-ical
()
104 "Test method for `icalendar--convert-block-to-ical'."
105 (let* ((calendar-date-style 'iso
)
107 (setq result
(icalendar--convert-block-to-ical
108 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
109 (should (consp result
))
110 (should (string= (concat
111 "\nDTSTART;VALUE=DATE:20040719"
112 "\nDTEND;VALUE=DATE:20040828")
114 (should (string= "Sommerferien" (cdr result
)))))
116 (ert-deftest icalendar--convert-yearly-to-ical
()
117 "Test method for `icalendar--convert-yearly-to-ical'."
118 (let* ((calendar-date-style 'iso
)
120 (calendar-month-name-array
121 ["January" "February" "March" "April" "May" "June" "July" "August"
122 "September" "October" "November" "December"]))
123 (setq result
(icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
124 (should (consp result
))
125 (should (string= (concat
126 "\nDTSTART;VALUE=DATE:19000501"
127 "\nDTEND;VALUE=DATE:19000502"
128 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
130 (should (string= "Tag der Arbeit" (cdr result
)))))
132 (ert-deftest icalendar--convert-weekly-to-ical
()
133 "Test method for `icalendar--convert-weekly-to-ical'."
134 (let* ((calendar-date-style 'iso
)
136 (calendar-day-name-array
137 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
139 (setq result
(icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
140 (should (consp result
))
141 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
142 "\nDTEND;VALUE=DATE-TIME:20050103T093000"
143 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
145 (should (string= "subject" (cdr result
)))))
147 (ert-deftest icalendar--convert-sexp-to-ical
()
148 "Test method for `icalendar--convert-sexp-to-ical'."
150 (icalendar-export-sexp-enumeration-days 3))
151 ;; test case %%(diary-hebrew-date)
152 (setq result
(icalendar--convert-sexp-to-ical "" "%%(diary-hebrew-date)"))
153 (should (consp result
))
154 (should (eq icalendar-export-sexp-enumeration-days
(length result
)))
157 (should (string-match "Hebrew date (until sunset): .*" (cdr i
))))
160 (ert-deftest icalendar--convert-to-ical
()
161 "Test method for `icalendar--convert-to-ical'."
163 (icalendar-export-sexp-enumerate-all t
)
164 (icalendar-export-sexp-enumeration-days 3)
165 (calendar-date-style 'iso
))
166 ;; test case: %%(diary-anniversary 1642 12 25) Newton
167 ;; forced enumeration not matching the actual day --> empty
168 (setq result
(icalendar--convert-sexp-to-ical
169 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
170 (encode-time 1 1 1 6 12 2014)))
171 (should (null result
))
172 ;; test case: %%(diary-anniversary 1642 12 25) Newton
173 ;; enumeration does match the actual day -->
174 (setq result
(icalendar--convert-sexp-to-ical
175 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
176 (encode-time 1 1 1 24 12 2014)))
177 (should (= 1 (length result
)))
178 (should (consp (car result
)))
179 (should (string-match
180 "\nDTSTART;VALUE=DATE:20141225\nDTEND;VALUE=DATE:20141226"
182 (should (string-match "Newton's birthday" (cdr (car result
))))))
184 (ert-deftest icalendar--parse-vtimezone
()
185 "Test method for `icalendar--parse-vtimezone'."
186 (let (vtimezone result
)
187 (setq vtimezone
(icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
190 DTSTART:16010101T040000
193 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
196 DTSTART:16010101T030000
199 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
203 (setq result
(icalendar--parse-vtimezone vtimezone
))
204 (should (string= "thename" (car result
)))
205 (message (cdr result
))
206 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
208 (setq vtimezone
(icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
209 TZID:anothername, with a comma
211 DTSTART:16010101T040000
214 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
217 DTSTART:16010101T030000
220 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
224 (setq result
(icalendar--parse-vtimezone vtimezone
))
225 (should (string= "anothername, with a comma" (car result
)))
226 (message (cdr result
))
227 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
229 ;; offsetfrom = offsetto
230 (setq vtimezone
(icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
231 TZID:Kolkata, Chennai, Mumbai, New Delhi
232 X-MICROSOFT-CDO-TZID:23
234 DTSTART:16010101T000000
239 DTSTART:16010101T000000
245 (setq result
(icalendar--parse-vtimezone vtimezone
))
246 (should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result
)))
247 (message (cdr result
))
248 (should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00"
251 (ert-deftest icalendar--convert-ordinary-to-ical
()
252 "Test method for `icalendar--convert-ordinary-to-ical'."
253 (let* ((calendar-date-style 'iso
)
256 (setq result
(icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
257 (should (consp result
))
258 (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
260 (should (string= "subject" (cdr result
)))
263 (setq result
(icalendar--convert-ordinary-to-ical
264 "&?" "&2010 2 15 12:34 s"))
265 (should (consp result
))
266 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
267 "\nDTEND;VALUE=DATE-TIME:20100215T133400")
269 (should (string= "s" (cdr result
)))
272 (setq result
(icalendar--convert-ordinary-to-ical
273 "&?" "&2010 2 15 12:34-23:45 s"))
274 (should (consp result
))
275 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
276 "\nDTEND;VALUE=DATE-TIME:20100215T234500")
278 (should (string= "s" (cdr result
)))
280 ;; with time, again -- test bug#5549
281 (setq result
(icalendar--convert-ordinary-to-ical
282 "x?" "x2010 2 15 0:34-1:45 s"))
283 (should (consp result
))
284 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
285 "\nDTEND;VALUE=DATE-TIME:20100215T014500")
287 (should (string= "s" (cdr result
)))))
289 (ert-deftest icalendar--diarytime-to-isotime
()
290 "Test method for `icalendar--diarytime-to-isotime'."
291 (should (string= "T011500"
292 (icalendar--diarytime-to-isotime "01:15" "")))
293 (should (string= "T011500"
294 (icalendar--diarytime-to-isotime "1:15" "")))
295 (should (string= "T000100"
296 (icalendar--diarytime-to-isotime "0:01" "")))
297 (should (string= "T010000"
298 (icalendar--diarytime-to-isotime "0100" "")))
299 (should (string= "T010000"
300 (icalendar--diarytime-to-isotime "0100" "am")))
301 (should (string= "T130000"
302 (icalendar--diarytime-to-isotime "0100" "pm")))
303 (should (string= "T120000"
304 (icalendar--diarytime-to-isotime "1200" "")))
305 (should (string= "T171700"
306 (icalendar--diarytime-to-isotime "17:17" "")))
307 (should (string= "T000000"
308 (icalendar--diarytime-to-isotime "1200" "am")))
309 (should (string= "T000100"
310 (icalendar--diarytime-to-isotime "1201" "am")))
311 (should (string= "T005900"
312 (icalendar--diarytime-to-isotime "1259" "am")))
313 (should (string= "T120000"
314 (icalendar--diarytime-to-isotime "1200" "pm")))
315 (should (string= "T120100"
316 (icalendar--diarytime-to-isotime "1201" "pm")))
317 (should (string= "T125900"
318 (icalendar--diarytime-to-isotime "1259" "pm")))
319 (should (string= "T150000"
320 (icalendar--diarytime-to-isotime "3" "pm"))))
322 (ert-deftest icalendar--datetime-to-diary-date
()
323 "Test method for `icalendar--datetime-to-diary-date'."
324 (let* ((datetime '(59 59 23 31 12 2008))
325 (calendar-date-style 'iso
))
326 (should (string= "2008 12 31"
327 (icalendar--datetime-to-diary-date datetime
)))
328 (setq calendar-date-style
'european
)
329 (should (string= "31 12 2008"
330 (icalendar--datetime-to-diary-date datetime
)))
331 (setq calendar-date-style
'american
)
332 (should (string= "12 31 2008"
333 (icalendar--datetime-to-diary-date datetime
)))))
335 (ert-deftest icalendar--datestring-to-isodate
()
336 "Test method for `icalendar--datestring-to-isodate'."
337 (let ((calendar-date-style 'iso
))
339 (should (string= "20080511"
340 (icalendar--datestring-to-isodate "2008 05 11")))
341 (should (string= "20080531"
342 (icalendar--datestring-to-isodate "2008 05 31")))
343 (should (string= "20080602"
344 (icalendar--datestring-to-isodate "2008 05 31" 2)))
347 (setq calendar-date-style
'european
)
348 (should (string= "20080511"
349 (icalendar--datestring-to-isodate "11 05 2008")))
350 (should (string= "20080531"
351 (icalendar--datestring-to-isodate "31 05 2008")))
352 (should (string= "20080602"
353 (icalendar--datestring-to-isodate "31 05 2008" 2)))
356 (setq calendar-date-style
'american
)
357 (should (string= "20081105"
358 (icalendar--datestring-to-isodate "11 05 2008")))
359 (should (string= "20081230"
360 (icalendar--datestring-to-isodate "12 30 2008")))
361 (should (string= "20090101"
362 (icalendar--datestring-to-isodate "12 30 2008" 2)))
365 (setq calendar-date-style nil
) ;not necessary for conversion
366 (should (string= "20081105"
367 (icalendar--datestring-to-isodate "Nov 05 2008")))
368 (should (string= "20081105"
369 (icalendar--datestring-to-isodate "05 Nov 2008")))
370 (should (string= "20081105"
371 (icalendar--datestring-to-isodate "2008 Nov 05")))))
373 (ert-deftest icalendar--first-weekday-of-year
()
374 "Test method for `icalendar-first-weekday-of-year'."
375 (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
376 (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
377 (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
378 (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
379 (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
380 (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
381 (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
382 (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
383 (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
385 (ert-deftest icalendar--import-format-sample
()
386 "Test method for `icalendar-import-format-sample'."
387 (should (string= (concat "SUMMARY='a' DESCRIPTION='b' LOCATION='c' "
388 "ORGANIZER='d' STATUS='' URL='' CLASS=''")
389 (icalendar-import-format-sample
390 (icalendar-tests--get-ical-event "BEGIN:VEVENT
391 DTSTAMP:20030509T043439Z
392 DTSTART:20030509T103000
396 DTEND:20030509T153000
401 (ert-deftest icalendar--format-ical-event
()
402 "Test `icalendar--format-ical-event'."
403 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
404 (icalendar-import-format-summary "SUM %s")
405 (icalendar-import-format-location " LOC %s")
406 (icalendar-import-format-description " DES %s")
407 (icalendar-import-format-organizer " ORG %s")
408 (icalendar-import-format-status " STA %s")
409 (icalendar-import-format-url " URL %s")
410 (icalendar-import-format-class " CLA %s")
411 (event (icalendar-tests--get-ical-event "BEGIN:VEVENT
412 DTSTAMP:20030509T043439Z
413 DTSTART:20030509T103000
417 DTEND:20030509T153000
421 (should (string= "SUM sum DES des LOC loc ORG org"
422 (icalendar--format-ical-event event
)))
423 (setq icalendar-import-format
(lambda (&rest ignore
)
425 (should (string= "helloworld" (icalendar--format-ical-event event
)))
426 (setq icalendar-import-format
428 (format "-%s-%s-%s-%s-%s-%s-%s-"
429 (icalendar--get-event-property event
'SUMMARY
)
430 (icalendar--get-event-property event
'DESCRIPTION
)
431 (icalendar--get-event-property event
'LOCATION
)
432 (icalendar--get-event-property event
'ORGANIZER
)
433 (icalendar--get-event-property event
'STATUS
)
434 (icalendar--get-event-property event
'URL
)
435 (icalendar--get-event-property event
'CLASS
))))
436 (should (string= "-sum-des-loc-org-nil-nil-nil-"
437 (icalendar--format-ical-event event
)))))
439 (ert-deftest icalendar--parse-summary-and-rest
()
440 "Test `icalendar--parse-summary-and-rest'."
441 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
442 (icalendar-import-format-summary "SUM %s")
443 (icalendar-import-format-location " LOC %s")
444 (icalendar-import-format-description " DES %s")
445 (icalendar-import-format-organizer " ORG %s")
446 (icalendar-import-format-status " STA %s")
447 (icalendar-import-format-url " URL %s")
448 (icalendar-import-format-class " CLA %s")
450 (setq result
(icalendar--parse-summary-and-rest "SUM sum ORG org"))
451 (should (string= "org" (cdr (assoc 'org result
))))
453 (setq result
(icalendar--parse-summary-and-rest
454 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
455 (should (string= "des" (cdr (assoc 'des result
))))
456 (should (string= "loc" (cdr (assoc 'loc result
))))
457 (should (string= "org" (cdr (assoc 'org result
))))
458 (should (string= "sta" (cdr (assoc 'sta result
))))
459 (should (string= "cla" (cdr (assoc 'cla result
))))
461 (setq icalendar-import-format
(lambda () "Hello world"))
462 (setq result
(icalendar--parse-summary-and-rest
464 (should (not result
))
467 (ert-deftest icalendar--decode-isodatetime
()
468 "Test `icalendar--decode-isodatetime'."
469 (let ((tz (getenv "TZ"))
473 ;; Use Eastern European Time (UTC+2, UTC+3 daylight saving)
474 (setenv "TZ" "EET-2EEST,M3.5.0/3,M10.5.0/4")
476 (message "%s" (current-time-zone (encode-time 0 0 10 1 1 2013 0)))
477 (message "%s" (current-time-zone (encode-time 0 0 10 1 8 2013 0)))
479 ;; testcase: no time zone in input -> keep time as is
481 (should (equal '(0 0 10 1 1 2013 2 nil
7200)
482 (icalendar--decode-isodatetime "20130101T100000")))
483 ;; 1 Aug 2013 10:00 (DST)
484 (should (equal '(0 0 10 1 8 2013 4 t
10800)
485 (icalendar--decode-isodatetime "20130801T100000")))
487 ;; testcase: UTC time zone specifier in input -> convert to local time
488 ;; 31 Dec 2013 23:00 UTC -> 1 Jan 2013 01:00 EET
489 (should (equal '(0 0 1 1 1 2014 3 nil
7200)
490 (icalendar--decode-isodatetime "20131231T230000Z")))
491 ;; 1 Aug 2013 10:00 UTC -> 1 Aug 2013 13:00 EEST
492 (should (equal '(0 0 13 1 8 2013 4 t
10800)
493 (icalendar--decode-isodatetime "20130801T100000Z")))
496 ;; restore time-zone even if something went terribly wrong
499 ;; ======================================================================
501 ;; ======================================================================
503 (defun icalendar-tests--test-export (input-iso input-european input-american
504 expected-output
&optional alarms
)
505 "Perform an export test.
506 Argument INPUT-ISO iso style diary string.
507 Argument INPUT-EUROPEAN european style diary string.
508 Argument INPUT-AMERICAN american style diary string.
509 Argument EXPECTED-OUTPUT expected iCalendar result string.
510 Optional argument ALARMS the value of `icalendar-export-alarms' for this test.
512 European style input data must use german month names. American
513 and ISO style input data must use english month names."
514 (let ((tz (getenv "TZ"))
515 (calendar-date-style 'iso
)
516 (icalendar-recurring-start-year 2000)
517 (icalendar-export-alarms alarms
))
520 ;;; (message "Current time zone: %s" (current-time-zone))
521 ;; Use this form so as not to rely on system tz database.
522 ;; Eg hydra.nixos.org.
523 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
524 ;;; (message "Current time zone: %s" (current-time-zone))
526 (let ((calendar-month-name-array
527 ["January" "February" "March" "April" "May" "June" "July" "August"
528 "September" "October" "November" "December"])
529 (calendar-day-name-array
530 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
532 (setq calendar-date-style
'iso
)
533 (icalendar-tests--do-test-export input-iso expected-output
)))
535 (let ((calendar-month-name-array
536 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
537 "September" "Oktober" "November" "Dezember"])
538 (calendar-day-name-array
539 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
541 (setq calendar-date-style
'european
)
542 (icalendar-tests--do-test-export input-european expected-output
)))
544 (let ((calendar-month-name-array
545 ["January" "February" "March" "April" "May" "June" "July" "August"
546 "September" "October" "November" "December"])
547 (calendar-day-name-array
548 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
550 (setq calendar-date-style
'american
)
551 (icalendar-tests--do-test-export input-american expected-output
))))
552 ;; restore time-zone even if something went terribly wrong
555 (defun icalendar-tests--do-test-export (input expected-output
)
556 "Actually perform export test.
557 Argument INPUT input diary string.
558 Argument EXPECTED-OUTPUT expected iCalendar result string."
559 (let ((temp-file (make-temp-file "icalendar-tests-ics")))
564 (icalendar-export-region (point-min) (point-max) temp-file
))
566 (find-file temp-file
)
567 (goto-char (point-min))
568 (cond (expected-output
569 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
570 PRODID:-//Emacs//NONSGML icalendar.el//EN
579 (should (string-match
581 (regexp-quote (buffer-substring-no-properties
582 (match-beginning 1) (match-end 1)))
586 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
587 PRODID:-//Emacs//NONSGML icalendar.el//EN
593 (kill-buffer (find-buffer-visiting temp-file
))
594 (delete-file temp-file
))))
596 (ert-deftest icalendar-export-ordinary-no-time
()
597 "Perform export test."
599 (let ((icalendar-export-hidden-diary-entries nil
))
600 (icalendar-tests--test-export
601 "&2000 Oct 3 ordinary no time "
602 "&3 Okt 2000 ordinary no time "
603 "&Oct 3 2000 ordinary no time "
606 (icalendar-tests--test-export
607 "2000 Oct 3 ordinary no time "
608 "3 Okt 2000 ordinary no time "
609 "Oct 3 2000 ordinary no time "
610 "DTSTART;VALUE=DATE:20001003
611 DTEND;VALUE=DATE:20001004
612 SUMMARY:ordinary no time
615 (ert-deftest icalendar-export-ordinary
()
616 "Perform export test."
618 (icalendar-tests--test-export
619 "2000 Oct 3 16:30 ordinary with time"
620 "3 Okt 2000 16:30 ordinary with time"
621 "Oct 3 2000 16:30 ordinary with time"
622 "DTSTART;VALUE=DATE-TIME:20001003T163000
623 DTEND;VALUE=DATE-TIME:20001003T173000
624 SUMMARY:ordinary with time
626 (icalendar-tests--test-export
627 "2000 10 3 16:30 ordinary with time 2"
628 "3 10 2000 16:30 ordinary with time 2"
629 "10 3 2000 16:30 ordinary with time 2"
630 "DTSTART;VALUE=DATE-TIME:20001003T163000
631 DTEND;VALUE=DATE-TIME:20001003T173000
632 SUMMARY:ordinary with time 2
635 (icalendar-tests--test-export
636 "2000/10/3 16:30 ordinary with time 3"
637 "3/10/2000 16:30 ordinary with time 3"
638 "10/3/2000 16:30 ordinary with time 3"
639 "DTSTART;VALUE=DATE-TIME:20001003T163000
640 DTEND;VALUE=DATE-TIME:20001003T173000
641 SUMMARY:ordinary with time 3
644 (ert-deftest icalendar-export-multiline
()
645 "Perform export test."
647 ;; multiline -- FIXME!!!
648 (icalendar-tests--test-export
649 "2000 October 3 16:30 multiline
650 17:30 multiline continued FIXME"
651 "3 Oktober 2000 16:30 multiline
652 17:30 multiline continued FIXME"
653 "October 3 2000 16:30 multiline
654 17:30 multiline continued FIXME"
655 "DTSTART;VALUE=DATE-TIME:20001003T163000
656 DTEND;VALUE=DATE-TIME:20001003T173000
659 17:30 multiline continued FIXME
662 (ert-deftest icalendar-export-weekly-by-day
()
663 "Perform export test."
666 (icalendar-tests--test-export
667 "Monday 1:30pm weekly by day with start time"
668 "Montag 13:30 weekly by day with start time"
669 "Monday 1:30pm weekly by day with start time"
670 "DTSTART;VALUE=DATE-TIME:20000103T133000
671 DTEND;VALUE=DATE-TIME:20000103T143000
672 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
673 SUMMARY:weekly by day with start time
676 (icalendar-tests--test-export
677 "Monday 13:30-15:00 weekly by day with start and end time"
678 "Montag 13:30-15:00 weekly by day with start and end time"
679 "Monday 01:30pm-03:00pm weekly by day with start and end time"
680 "DTSTART;VALUE=DATE-TIME:20000103T133000
681 DTEND;VALUE=DATE-TIME:20000103T150000
682 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
683 SUMMARY:weekly by day with start and end time
686 (ert-deftest icalendar-export-yearly
()
687 "Perform export test."
689 (icalendar-tests--test-export
690 "may 1 yearly no time"
691 "1 Mai yearly no time"
692 "may 1 yearly no time"
693 "DTSTART;VALUE=DATE:19000501
694 DTEND;VALUE=DATE:19000502
695 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
696 SUMMARY:yearly no time
699 (ert-deftest icalendar-export-anniversary
()
700 "Perform export test."
702 (icalendar-tests--test-export
703 "%%(diary-anniversary 1989 10 3) anniversary no time"
704 "%%(diary-anniversary 3 10 1989) anniversary no time"
705 "%%(diary-anniversary 10 3 1989) anniversary no time"
706 "DTSTART;VALUE=DATE:19891003
707 DTEND;VALUE=DATE:19891004
708 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
709 SUMMARY:anniversary no time
711 (icalendar-tests--test-export
712 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
713 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
714 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
715 "DTSTART;VALUE=DATE-TIME:19891003T190000
716 DTEND;VALUE=DATE-TIME:19891004T200000
717 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
718 SUMMARY:anniversary with time
721 (ert-deftest icalendar-export-block
()
722 "Perform export test."
724 (icalendar-tests--test-export
725 "%%(diary-block 2001 6 18 2001 7 6) block no time"
726 "%%(diary-block 18 6 2001 6 7 2001) block no time"
727 "%%(diary-block 6 18 2001 7 6 2001) block no time"
728 "DTSTART;VALUE=DATE:20010618
729 DTEND;VALUE=DATE:20010707
730 SUMMARY:block no time
732 (icalendar-tests--test-export
733 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
734 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
735 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
736 "DTSTART;VALUE=DATE-TIME:20010618T130000
737 DTEND;VALUE=DATE-TIME:20010618T170000
738 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
739 SUMMARY:block with time
741 (icalendar-tests--test-export
742 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
743 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
744 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
745 "DTSTART;VALUE=DATE-TIME:20010618T130000
746 DTEND;VALUE=DATE-TIME:20010618T140000
747 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
748 SUMMARY:block no end time
751 (ert-deftest icalendar-export-alarms
()
752 "Perform export test with different settings for exporting alarms."
754 (icalendar-tests--test-export
755 "2014 Nov 17 19:30 no alarm"
756 "17 Nov 2014 19:30 no alarm"
757 "Nov 17 2014 19:30 no alarm"
758 "DTSTART;VALUE=DATE-TIME:20141117T193000
759 DTEND;VALUE=DATE-TIME:20141117T203000
764 ;; 10 minutes in advance, audio
765 (icalendar-tests--test-export
766 "2014 Nov 17 19:30 audio alarm"
767 "17 Nov 2014 19:30 audio alarm"
768 "Nov 17 2014 19:30 audio alarm"
769 "DTSTART;VALUE=DATE-TIME:20141117T193000
770 DTEND;VALUE=DATE-TIME:20141117T203000
779 ;; 20 minutes in advance, display
780 (icalendar-tests--test-export
781 "2014 Nov 17 19:30 display alarm"
782 "17 Nov 2014 19:30 display alarm"
783 "Nov 17 2014 19:30 display alarm"
784 "DTSTART;VALUE=DATE-TIME:20141117T193000
785 DTEND;VALUE=DATE-TIME:20141117T203000
786 SUMMARY:display alarm
790 DESCRIPTION:display alarm
795 ;; 66 minutes in advance, email
796 (icalendar-tests--test-export
797 "2014 Nov 17 19:30 email alarm"
798 "17 Nov 2014 19:30 email alarm"
799 "Nov 17 2014 19:30 email alarm"
800 "DTSTART;VALUE=DATE-TIME:20141117T193000
801 DTEND;VALUE=DATE-TIME:20141117T203000
806 DESCRIPTION:email alarm
808 ATTENDEE:MAILTO:att.one@email.com
809 ATTENDEE:MAILTO:att.two@email.com
812 '(66 ((email ("att.one@email.com" "att.two@email.com")))))
814 ;; 2 minutes in advance, all alarms
815 (icalendar-tests--test-export
816 "2014 Nov 17 19:30 all alarms"
817 "17 Nov 2014 19:30 all alarms"
818 "Nov 17 2014 19:30 all alarms"
819 "DTSTART;VALUE=DATE-TIME:20141117T193000
820 DTEND;VALUE=DATE-TIME:20141117T203000
825 DESCRIPTION:all alarms
827 ATTENDEE:MAILTO:att.one@email.com
828 ATTENDEE:MAILTO:att.two@email.com
837 DESCRIPTION:all alarms
840 '(2 ((email ("att.one@email.com" "att.two@email.com")) (audio) (display)))))
842 ;; ======================================================================
844 ;; ======================================================================
846 (defun icalendar-tests--test-import (input expected-iso expected-european
848 "Perform import test.
849 Argument INPUT icalendar event string.
850 Argument EXPECTED-ISO expected iso style diary string.
851 Argument EXPECTED-EUROPEAN expected european style diary string.
852 Argument EXPECTED-AMERICAN expected american style diary string.
853 During import test the timezone is set to Central European Time."
854 (let ((timezone (getenv "TZ")))
857 ;; Use this form so as not to rely on system tz database.
858 ;; Eg hydra.nixos.org.
859 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
861 (if (string-match "^BEGIN:VCALENDAR" input
)
863 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
864 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
866 (unless (eq (char-before) ?
\n)
868 (insert "END:VEVENT\nEND:VCALENDAR\n"))
869 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
870 (icalendar-import-format-summary "%s")
871 (icalendar-import-format-location "\n Location: %s")
872 (icalendar-import-format-description "\n Desc: %s")
873 (icalendar-import-format-organizer "\n Organizer: %s")
874 (icalendar-import-format-status "\n Status: %s")
875 (icalendar-import-format-url "\n URL: %s")
876 (icalendar-import-format-class "\n Class: %s")
877 (icalendar-import-format-uid "\n UID: %s")
880 (setq calendar-date-style
'iso
)
881 (icalendar-tests--do-test-import input expected-iso
))
882 (when expected-european
883 (setq calendar-date-style
'european
)
884 (icalendar-tests--do-test-import input expected-european
))
885 (when expected-american
886 (setq calendar-date-style
'american
)
887 (icalendar-tests--do-test-import input expected-american
)))))
888 (setenv "TZ" timezone
))))
890 (defun icalendar-tests--do-test-import (input expected-output
)
891 "Actually perform import test.
892 Argument INPUT input icalendar string.
893 Argument EXPECTED-OUTPUT expected diary string."
894 (let ((temp-file (make-temp-file "icalendar-test-diary")))
895 ;; Test the Catch-the-mysterious-coding-header logic below.
896 ;; Ruby-mode adds an after-save-hook which inserts the header!
898 ;; (find-file temp-file)
900 (icalendar-import-buffer temp-file t t
)
902 (find-file temp-file
)
903 ;; Check for the mysterious "# coding: ..." header, remove it
905 (goto-char (point-min))
906 (when (re-search-forward "# coding: .*?\n" nil t
)
907 (message (concat "%s\n"
908 "Found mysterious \"# coding ...\" header! Removing it.\n"
909 "Current Modes: %s, %s\n"
917 (buffer-disable-undo)
919 (set-buffer-modified-p nil
))
921 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
922 (should (string= expected-output result
)))
923 (kill-buffer (find-buffer-visiting temp-file
))
924 (delete-file temp-file
))))
926 (ert-deftest icalendar-import-non-recurring
()
927 "Perform standard import tests."
928 (icalendar-tests--test-import
929 "SUMMARY:non-recurring
930 DTSTART;VALUE=DATE-TIME:20030919T090000
931 DTEND;VALUE=DATE-TIME:20030919T113000"
932 "&2003/9/19 09:00-11:30 non-recurring\n"
933 "&19/9/2003 09:00-11:30 non-recurring\n"
934 "&9/19/2003 09:00-11:30 non-recurring\n")
935 (icalendar-tests--test-import
936 "SUMMARY:non-recurring allday
937 DTSTART;VALUE=DATE-TIME:20030919"
938 "&2003/9/19 non-recurring allday\n"
939 "&19/9/2003 non-recurring allday\n"
940 "&9/19/2003 non-recurring allday\n")
941 (icalendar-tests--test-import
942 ;; Checkdoc removes trailing blanks. Therefore: format!
943 (format "%s\n%s\n%s" "SUMMARY:long " " summary"
944 "DTSTART;VALUE=DATE:20030919")
945 "&2003/9/19 long summary\n"
946 "&19/9/2003 long summary\n"
947 "&9/19/2003 long summary\n")
948 (icalendar-tests--test-import
949 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
953 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
954 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
955 DTSTART;VALUE=DATE:20040719
956 DTEND;VALUE=DATE:20040828
957 DTSTAMP:20031103T011641Z
959 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
962 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
964 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
967 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
969 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
972 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
974 (icalendar-tests--test-import
976 :04979712-3902-11d9-93dd-8f9f4afe08da
983 X-MOZILLA-ALARM-DEFAULT-LENGTH
994 "&2004/11/23 14:00-14:30 folded summary
997 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
998 "&23/11/2004 14:00-14:30 folded summary
1001 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
1002 "&11/23/2004 14:00-14:30 folded summary
1005 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
1007 (icalendar-tests--test-import
1009 :6161a312-3902-11d9-b512-f764153bb28b
1016 X-MOZILLA-ALARM-DEFAULT-LENGTH
1025 "&2004/11/23 14:45-15:45 another example
1028 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1029 "&23/11/2004 14:45-15:45 another example
1032 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1033 "&11/23/2004 14:45-15:45 another example
1036 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
1038 (ert-deftest icalendar-import-rrule
()
1039 (icalendar-tests--test-import
1040 "SUMMARY:rrule daily
1041 DTSTART;VALUE=DATE-TIME:20030919T090000
1042 DTEND;VALUE=DATE-TIME:20030919T113000
1045 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily\n"
1046 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily\n"
1047 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily\n")
1049 (icalendar-tests--test-import
1050 "SUMMARY:rrule daily
1051 DTSTART;VALUE=DATE-TIME:20030919T090000
1052 DTEND;VALUE=DATE-TIME:20030919T113000
1053 RRULE:FREQ=DAILY;INTERVAL=2
1055 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily\n"
1056 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily\n"
1057 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily\n")
1058 (icalendar-tests--test-import
1059 "SUMMARY:rrule daily with exceptions
1060 DTSTART;VALUE=DATE-TIME:20030919T090000
1061 DTEND;VALUE=DATE-TIME:20030919T113000
1062 RRULE:FREQ=DAILY;INTERVAL=2
1063 EXDATE:20030921,20030925
1065 "&%%(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"
1066 "&%%(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"
1067 "&%%(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")
1068 (icalendar-tests--test-import
1069 "SUMMARY:rrule weekly
1070 DTSTART;VALUE=DATE-TIME:20030919T090000
1071 DTEND;VALUE=DATE-TIME:20030919T113000
1074 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly\n"
1075 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly\n"
1076 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly\n")
1077 (icalendar-tests--test-import
1078 "SUMMARY:rrule monthly no end
1079 DTSTART;VALUE=DATE-TIME:20030919T090000
1080 DTEND;VALUE=DATE-TIME:20030919T113000
1083 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end\n"
1084 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n"
1085 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n")
1086 (icalendar-tests--test-import
1087 "SUMMARY:rrule monthly with end
1088 DTSTART;VALUE=DATE-TIME:20030919T090000
1089 DTEND;VALUE=DATE-TIME:20030919T113000
1090 RRULE:FREQ=MONTHLY;UNTIL=20050819;
1092 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end\n"
1093 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end\n"
1094 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end\n")
1095 (icalendar-tests--test-import
1096 "DTSTART;VALUE=DATE:20040815
1097 DTEND;VALUE=DATE:20040816
1098 SUMMARY:Maria Himmelfahrt
1099 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
1101 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
1102 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt\n"
1103 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt\n")
1104 (icalendar-tests--test-import
1105 "SUMMARY:rrule yearly
1106 DTSTART;VALUE=DATE-TIME:20030919T090000
1107 DTEND;VALUE=DATE-TIME:20030919T113000
1108 RRULE:FREQ=YEARLY;INTERVAL=2
1110 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly\n" ;FIXME
1111 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly\n" ;FIXME
1112 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly\n") ;FIXME
1113 (icalendar-tests--test-import
1114 "SUMMARY:rrule count daily short
1115 DTSTART;VALUE=DATE-TIME:20030919T090000
1116 DTEND;VALUE=DATE-TIME:20030919T113000
1117 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
1119 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short\n"
1120 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short\n"
1121 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short\n")
1122 (icalendar-tests--test-import
1123 "SUMMARY:rrule count daily long
1124 DTSTART;VALUE=DATE-TIME:20030919T090000
1125 DTEND;VALUE=DATE-TIME:20030919T113000
1126 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
1128 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long\n"
1129 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long\n"
1130 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long\n")
1131 (icalendar-tests--test-import
1132 "SUMMARY:rrule count bi-weekly 3 times
1133 DTSTART;VALUE=DATE-TIME:20030919T090000
1134 DTEND;VALUE=DATE-TIME:20030919T113000
1135 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
1137 "&%%(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"
1138 "&%%(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"
1139 "&%%(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")
1140 (icalendar-tests--test-import
1141 "SUMMARY:rrule count monthly
1142 DTSTART;VALUE=DATE-TIME:20030919T090000
1143 DTEND;VALUE=DATE-TIME:20030919T113000
1144 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
1146 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly\n"
1147 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly\n"
1148 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly\n")
1149 (icalendar-tests--test-import
1150 "SUMMARY:rrule count every second month
1151 DTSTART;VALUE=DATE-TIME:20030919T090000
1152 DTEND;VALUE=DATE-TIME:20030919T113000
1153 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
1155 "&%%(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
1156 "&%%(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
1157 "&%%(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
1158 (icalendar-tests--test-import
1159 "SUMMARY:rrule count yearly
1160 DTSTART;VALUE=DATE-TIME:20030919T090000
1161 DTEND;VALUE=DATE-TIME:20030919T113000
1162 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
1164 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly\n"
1165 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly\n"
1166 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly\n")
1167 (icalendar-tests--test-import
1168 "SUMMARY:rrule count every second year
1169 DTSTART;VALUE=DATE-TIME:20030919T090000
1170 DTEND;VALUE=DATE-TIME:20030919T113000
1171 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
1173 "&%%(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!!!
1174 "&%%(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!!!
1175 "&%%(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!!!
1178 (ert-deftest icalendar-import-duration
()
1180 (icalendar-tests--test-import
1181 "DTSTART;VALUE=DATE:20050217
1185 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration\n"
1186 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration\n"
1187 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration\n")
1188 (icalendar-tests--test-import
1189 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
1190 DTSTAMP:20041127T183315Z
1191 LAST-MODIFIED:20041127T183329
1193 DTSTART;VALUE=DATE:20011221
1194 DTEND;VALUE=DATE:20011221
1195 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
1198 CREATED:20041127T183329
1200 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
1202 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1203 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
1205 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1206 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
1208 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
1210 (ert-deftest icalendar-import-bug-6766
()
1211 ;;bug#6766 -- multiple byday values in a weekly rrule
1212 (icalendar-tests--test-import
1214 DTEND;TZID=America/New_York:20100421T120000
1215 DTSTAMP:20100525T141214Z
1216 DTSTART;TZID=America/New_York:20100421T113000
1217 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
1222 UID:8814e3f9-7482-408f-996c-3bfe486a1262
1226 DTSTAMP:20100525T141214Z
1227 DTSTART;VALUE=DATE:20100422
1228 DTEND;VALUE=DATE:20100423
1229 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
1231 SUMMARY:Tues + Thurs thinking
1233 UID:8814e3f9-7482-408f-996c-3bfe486a1263
1235 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1238 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1239 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1241 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1243 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1246 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1247 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1249 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1251 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1254 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1255 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1257 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1260 (ert-deftest icalendar-import-multiple-vcalendars
()
1261 (icalendar-tests--test-import
1262 "DTSTART;VALUE=DATE:20110723
1265 "&2011/7/23 event-1\n"
1266 "&23/7/2011 event-1\n"
1267 "&7/23/2011 event-1\n")
1269 (icalendar-tests--test-import
1271 PRODID:-//Emacs//NONSGML icalendar.el//EN
1272 VERSION:2.0\nBEGIN:VEVENT
1273 DTSTART;VALUE=DATE:20110723
1278 PRODID:-//Emacs//NONSGML icalendar.el//EN
1281 DTSTART;VALUE=DATE:20110724
1286 PRODID:-//Emacs//NONSGML icalendar.el//EN
1289 DTSTART;VALUE=DATE:20110725
1293 DTSTART;VALUE=DATE:20110725
1298 "&2011/7/23 event-1\n&2011/7/24 event-2\n&2011/7/25 event-3a\n&2011/7/25 event-3b\n"
1299 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
1300 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
1302 (ert-deftest icalendar-import-with-uid
()
1303 "Perform import test with uid."
1304 (icalendar-tests--test-import
1306 SUMMARY:non-recurring
1307 DTSTART;VALUE=DATE-TIME:20030919T090000
1308 DTEND;VALUE=DATE-TIME:20030919T113000"
1309 "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1310 "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1311 "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
1313 (ert-deftest icalendar-import-with-timezone
()
1314 ;; This is known to fail on MS-Windows, because the test assumes
1315 ;; Posix features of specifying DST rules.
1316 :expected-result
(if (memq system-type
'(windows-nt ms-dos
))
1320 (icalendar-tests--test-import
1323 TZID:fictional, nonexistent, arbitrary
1325 DTSTART:20100101T000000
1328 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01
1331 DTSTART:20101201T000000
1334 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
1338 SUMMARY:standardtime
1339 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000
1340 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000
1343 SUMMARY:daylightsavingtime
1344 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000
1345 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000
1348 ;; "standardtime" begins first sunday in january and is 4 hours behind CET
1349 ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET
1350 "&2012/1/15 15:00-15:30 standardtime
1351 &2012/12/15 11:00-11:30 daylightsavingtime
1356 ;; ======================================================================
1358 ;; ======================================================================
1359 (defun icalendar-tests--test-cycle (input)
1360 "Perform cycle test.
1361 Argument INPUT icalendar event string."
1363 (if (string-match "^BEGIN:VCALENDAR" input
)
1365 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
1366 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
1368 (unless (eq (char-before) ?
\n)
1370 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1371 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
1372 (icalendar-import-format-summary "%s")
1373 (icalendar-import-format-location "\n Location: %s")
1374 (icalendar-import-format-description "\n Desc: %s")
1375 (icalendar-import-format-organizer "\n Organizer: %s")
1376 (icalendar-import-format-status "\n Status: %s")
1377 (icalendar-import-format-url "\n URL: %s")
1378 (icalendar-import-format-class "\n Class: %s")
1379 (icalendar-import-format-class "\n UID: %s")
1380 (icalendar-export-alarms nil
))
1381 (dolist (calendar-date-style '(iso european american
))
1382 (icalendar-tests--do-test-cycle)))))
1384 (defun icalendar-tests--do-test-cycle ()
1385 "Actually perform import/export cycle test."
1386 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
1387 (temp-ics (make-temp-file "icalendar-test-ics"))
1388 (org-input (buffer-substring-no-properties (point-min) (point-max))))
1393 (icalendar-import-buffer temp-diary t t
)
1395 ;; step 2: export what was just imported
1397 (find-file temp-diary
)
1398 (icalendar-export-region (point-min) (point-max) temp-ics
))
1400 ;; compare the output of step 2 with the input of step 1
1402 (find-file temp-ics
)
1403 (goto-char (point-min))
1404 ;;(when (re-search-forward "\nUID:.*\n" nil t)
1405 ;;(replace-match "\n"))
1406 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1407 (should (string= org-input cycled
)))))
1409 (kill-buffer (find-buffer-visiting temp-diary
))
1410 (with-current-buffer (find-buffer-visiting temp-ics
)
1411 (set-buffer-modified-p nil
)
1412 (kill-buffer (current-buffer)))
1413 (delete-file temp-diary
)
1414 (delete-file temp-ics
))))
1416 (ert-deftest icalendar-cycle
()
1417 "Perform cycling tests.
1418 Take care to avoid auto-generated UIDs here."
1419 (icalendar-tests--test-cycle
1421 DTSTART;VALUE=DATE-TIME:20030919T090000
1422 DTEND;VALUE=DATE-TIME:20030919T113000
1425 (icalendar-tests--test-cycle
1427 DTSTART;VALUE=DATE-TIME:20030919T090000
1428 DTEND;VALUE=DATE-TIME:20030919T113000
1430 DESCRIPTION:beschreibung!
1434 (icalendar-tests--test-cycle
1436 DTSTART;VALUE=DATE:19190909
1437 DTEND;VALUE=DATE:19190910
1438 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1439 SUMMARY:and diary-anniversary
1442 ;; ======================================================================
1444 ;; ======================================================================
1445 (ert-deftest icalendar-real-world
()
1446 "Perform real-world tests, as gathered from problem reports."
1447 ;; This is known to fail on MS-Windows, since it doesn't support DST
1448 ;; specification with month and day.
1449 :expected-result
(if (memq system-type
'(windows-nt ms-dos
))
1453 (icalendar-tests--test-import
1456 PRODID:Microsoft CDO for Microsoft Exchange
1459 TZID:Kolkata, Chennai, Mumbai, New Delhi
1460 X-MICROSOFT-CDO-TZID:23
1462 DTSTART:16010101T000000
1467 DTSTART:16010101T000000
1473 DTSTAMP:20030509T043439Z
1474 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
1475 SUMMARY:On-Site Interview
1476 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
1477 010000000DB823520692542408ED02D7023F9DFF9
1478 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
1479 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
1480 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
1481 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
1482 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
1483 zz\":MAILTO:zzzzzz@zzzzzzz.com
1484 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
1486 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
1487 DESCRIPTION:10:30am - Blah
1491 CREATED:20030509T043439Z
1492 LAST-MODIFIED:20030509T043459Z
1495 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1496 X-MICROSOFT-CDO-INSTTYPE:0
1497 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1498 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1499 X-MICROSOFT-CDO-IMPORTANCE:1
1500 X-MICROSOFT-CDO-OWNERAPPTID:126441427
1503 DESCRIPTION:REMINDER
1504 TRIGGER;RELATED=START:-PT00H15M00S
1509 "&9/5/2003 07:00-12:00 On-Site Interview
1510 Desc: 10:30am - Blah
1512 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1514 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1516 "&5/9/2003 07:00-12:00 On-Site Interview
1517 Desc: 10:30am - Blah
1519 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1521 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1524 ;; created with http://apps.marudot.com/ical/
1525 (icalendar-tests--test-import
1528 PRODID:-//www.marudot.com//iCal Event Maker
1533 TZURL:http://tzurl.org/zoneinfo-outlook/Asia/Tehran
1534 X-LIC-LOCATION:Asia/Tehran
1539 DTSTART:19700101T000000
1543 DTSTAMP:20141116T171439Z
1544 UID:20141116T171439Z-678877132@marudot.com
1545 DTSTART;TZID=\"Asia/Tehran\":20141116T070000
1546 DTEND;TZID=\"Asia/Tehran\":20141116T080000
1548 DESCRIPTION:Test event from timezone without DST
1553 "&16/11/2014 04:30-05:30 NoDST
1554 Desc: Test event from timezone without DST
1555 Location: Everywhere
1556 UID: 20141116T171439Z-678877132@marudot.com
1558 "&11/16/2014 04:30-05:30 NoDST
1559 Desc: Test event from timezone without DST
1560 Location: Everywhere
1561 UID: 20141116T171439Z-678877132@marudot.com
1566 (icalendar-tests--test-import
1567 "DTSTAMP:20030618T195512Z
1568 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
1569 SUMMARY:Dress Rehearsal for XXXX-XXXX
1570 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1571 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1572 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
1573 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
1574 ORGANIZER;CN=\"ABCD,TECHTRAINING
1575 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
1576 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
1577 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
1578 DESCRIPTION:753 Zeichen hier radiert
1582 CREATED:20030618T195518Z
1583 LAST-MODIFIED:20030618T195527Z
1586 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1587 X-MICROSOFT-CDO-INSTTYPE:0
1588 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1589 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1590 X-MICROSOFT-CDO-IMPORTANCE:1
1591 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1594 DESCRIPTION:REMINDER
1595 TRIGGER;RELATED=START:-PT00H15M00S
1598 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1599 Desc: 753 Zeichen hier radiert
1600 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1601 Organizer: MAILTO:xxx@xxxxx.com
1603 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1605 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1606 Desc: 753 Zeichen hier radiert
1607 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1608 Organizer: MAILTO:xxx@xxxxx.com
1610 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1612 ;; 2003-06-18 b -- uses timezone
1613 (icalendar-tests--test-import
1616 PRODID:Microsoft CDO for Microsoft Exchange
1619 TZID:Mountain Time (US & Canada)
1620 X-MICROSOFT-CDO-TZID:12
1622 DTSTART:16010101T020000
1625 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
1628 DTSTART:16010101T020000
1631 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
1635 DTSTAMP:20030618T230323Z
1636 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
1637 SUMMARY:Updated: Dress Rehearsal for ABC01-15
1638 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1639 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1640 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
1641 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
1642 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
1644 ORGANIZER;CN=\"ABCD,TECHTRAINING
1645 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
1646 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
1647 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
1648 DESCRIPTION:Viele Zeichen standen hier früher
1652 CREATED:20030618T230326Z
1653 LAST-MODIFIED:20030618T230335Z
1656 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1657 X-MICROSOFT-CDO-INSTTYPE:0
1658 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1659 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1660 X-MICROSOFT-CDO-IMPORTANCE:1
1661 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1664 DESCRIPTION:REMINDER
1665 TRIGGER;RELATED=START:-PT00H15M00S
1670 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1671 Desc: Viele Zeichen standen hier früher
1672 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1673 Organizer: MAILTO:bbb@bbbbb.com
1675 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1677 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1678 Desc: Viele Zeichen standen hier früher
1679 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1680 Organizer: MAILTO:bbb@bbbbb.com
1682 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1684 ;; export 2004-10-28 block entries
1685 (icalendar-tests--test-export
1688 "-*- mode: text; fill-column: 256;-*-
1692 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1694 "DTSTART;VALUE=DATE:20041108
1695 DTEND;VALUE=DATE:20041111
1696 SUMMARY:Nov 8-10 aa")
1698 (icalendar-tests--test-export
1701 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1702 "DTSTART;VALUE=DATE:20041213
1703 DTEND;VALUE=DATE:20041218
1704 SUMMARY:Dec 13-17 bb")
1706 (icalendar-tests--test-export
1709 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1710 "DTSTART;VALUE=DATE:20050203
1711 DTEND;VALUE=DATE:20050205
1712 SUMMARY:Feb 3-4 cc")
1714 (icalendar-tests--test-export
1717 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1718 "DTSTART;VALUE=DATE:20050424
1719 DTEND;VALUE=DATE:20050430
1720 SUMMARY:April 24-29 dd
1722 (icalendar-tests--test-export
1725 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1726 "DTSTART;VALUE=DATE:20050530
1727 DTEND;VALUE=DATE:20050602
1728 SUMMARY:may 30 - June 1: ee")
1730 (icalendar-tests--test-export
1733 "%%(diary-block 6 6 2005 6 8 2005) ff"
1734 "DTSTART;VALUE=DATE:20050606
1735 DTEND;VALUE=DATE:20050609
1738 ;; export 2004-10-28 anniversary entries
1739 (icalendar-tests--test-export
1745 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1746 "DTSTART;VALUE=DATE:19910328
1747 DTEND;VALUE=DATE:19910329
1748 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1749 SUMMARY:aa birthday (%d years old)
1752 (icalendar-tests--test-export
1755 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1756 "DTSTART;VALUE=DATE:19570517
1757 DTEND;VALUE=DATE:19570518
1758 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1759 SUMMARY:bb birthday (%d years old)")
1761 (icalendar-tests--test-export
1764 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1765 "DTSTART;VALUE=DATE:19970608
1766 DTEND;VALUE=DATE:19970609
1767 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1768 SUMMARY:cc birthday (%d years old)")
1770 (icalendar-tests--test-export
1773 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1774 "DTSTART;VALUE=DATE:19830722
1775 DTEND;VALUE=DATE:19830723
1776 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1777 SUMMARY:dd (%d years ago...!)")
1779 (icalendar-tests--test-export
1782 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1783 "DTSTART;VALUE=DATE:19880801
1784 DTEND;VALUE=DATE:19880802
1785 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1786 SUMMARY:ee birthday (%d years old)")
1788 (icalendar-tests--test-export
1791 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1792 "DTSTART;VALUE=DATE:19570921
1793 DTEND;VALUE=DATE:19570922
1794 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1795 SUMMARY:ff birthday (%d years old)")
1800 ;; export 2004-10-28 monthly, weekly entries
1802 ;; (icalendar-tests--test-export
1805 ;; >>> ------------ monthly:
1807 ;; */27/* 10:00 blah blah"
1810 (icalendar-tests--test-export
1813 ">>> ------------ my week:
1816 "DTSTART;VALUE=DATE-TIME:20000103T130000
1817 DTEND;VALUE=DATE-TIME:20000103T140000
1818 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1821 (icalendar-tests--test-export
1825 "DTSTART;VALUE=DATE-TIME:20000103T150000
1826 DTEND;VALUE=DATE-TIME:20000103T160000
1827 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1831 (icalendar-tests--test-export
1834 "Monday 16:00-17:00 a2"
1835 "DTSTART;VALUE=DATE-TIME:20000103T160000
1836 DTEND;VALUE=DATE-TIME:20000103T170000
1837 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1840 (icalendar-tests--test-export
1843 "Tuesday 11:30-13:00 a3"
1844 "DTSTART;VALUE=DATE-TIME:20000104T113000
1845 DTEND;VALUE=DATE-TIME:20000104T130000
1846 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1849 (icalendar-tests--test-export
1853 "DTSTART;VALUE=DATE-TIME:20000104T150000
1854 DTEND;VALUE=DATE-TIME:20000104T160000
1855 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1858 (icalendar-tests--test-export
1861 "Wednesday 13:00 a5"
1862 "DTSTART;VALUE=DATE-TIME:20000105T130000
1863 DTEND;VALUE=DATE-TIME:20000105T140000
1864 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1867 (icalendar-tests--test-export
1870 "Wednesday 11:30-13:30 a6"
1871 "DTSTART;VALUE=DATE-TIME:20000105T113000
1872 DTEND;VALUE=DATE-TIME:20000105T133000
1873 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1876 (icalendar-tests--test-export
1879 "Wednesday 15:00 s1"
1880 "DTSTART;VALUE=DATE-TIME:20000105T150000
1881 DTEND;VALUE=DATE-TIME:20000105T160000
1882 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1886 ;; export 2004-10-28 regular entries
1887 (icalendar-tests--test-export
1891 >>> regular diary entries:
1893 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1894 "DTSTART;VALUE=DATE-TIME:20041012T140000
1895 DTEND;VALUE=DATE-TIME:20041012T150000
1896 SUMMARY:Tue: [2004-10-12] q1")
1899 (icalendar-tests--test-import
1904 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1912 X-MOZILLA-ALARM-DEFAULT-LENGTH
1930 X-MOZILLA-ALARM-DEFAULT-LENGTH
1946 X-MOZILLA-ALARM-DEFAULT-LENGTH
1962 X-MOZILLA-ALARM-DEFAULT-LENGTH
1964 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1967 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1977 :Rrrr/Cccccc ii Aaaaaaaa
1979 :Vvvvv Rrrr aaa Cccccc
1984 X-MOZILLA-ALARM-DEFAULT-LENGTH
2004 X-MOZILLA-ALARM-DEFAULT-LENGTH
2007 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
2022 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
2025 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2028 &23/11/2004 11:00-12:00 Hhhhhhhh
2031 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
2034 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
2035 Desc: Vvvvv Rrrr aaa Cccccc
2038 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
2042 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
2045 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2048 &11/23/2004 11:00-12:00 Hhhhhhhh
2051 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
2054 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
2055 Desc: Vvvvv Rrrr aaa Cccccc
2058 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
2064 (icalendar-tests--test-export
2065 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
2068 "DTSTART;VALUE=DATE:20040101
2069 DTEND;VALUE=DATE:20040105
2073 (icalendar-tests--test-export
2075 "5 11 2004 Bla Fasel"
2077 "DTSTART;VALUE=DATE:20041105
2078 DTEND;VALUE=DATE:20041106
2082 (icalendar-tests--test-export
2084 "2 Nov 2004 15:00-16:30 Zahnarzt"
2086 "DTSTART;VALUE=DATE-TIME:20041102T150000
2087 DTEND;VALUE=DATE-TIME:20041102T163000
2091 (icalendar-tests--test-import
2093 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
2113 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
2117 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2119 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
2123 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2127 (icalendar-tests--test-import
2128 "DTSTART;VALUE=DATE:20050217
2129 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
2130 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
2131 DTSTAMP:20050118T210335Z
2134 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2135 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
2136 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2137 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
2140 (icalendar-tests--test-export
2142 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
2144 "DTSTART;VALUE=DATE-TIME:20050208T160000
2145 DTEND;VALUE=DATE-TIME:20050208T164500
2146 RRULE:FREQ=DAILY;INTERVAL=7
2151 (icalendar-tests--test-export
2154 ;; FIXME: colon not allowed!
2155 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2156 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2157 "DTSTART;VALUE=DATE:19001101
2158 DTEND;VALUE=DATE:19001102
2159 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
2160 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
2164 (icalendar-tests--test-import
2167 PRODID:Microsoft Exchange Server 2007
2170 TZID:(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
2172 DTSTART:16010101T030000
2175 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
2178 DTSTART:16010101T020000
2181 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
2185 ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com
2186 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth
2187 er\":MAILTO:other.luser@foo.com
2188 DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n
2189 SUMMARY;LANGUAGE=en-US:Query
2190 DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\"
2192 DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2
2194 UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000
2195 010000000575268034ECDB649A15349B1BF240F15
2196 RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V
2197 ienna\":20120515T170000
2200 DTSTAMP:20120514T153645Z
2204 LOCATION;LANGUAGE=en-US:phone
2205 X-MICROSOFT-CDO-APPT-SEQUENCE:15
2206 X-MICROSOFT-CDO-OWNERAPPTID:1907632092
2207 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
2208 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
2209 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
2210 X-MICROSOFT-CDO-IMPORTANCE:1
2211 X-MICROSOFT-CDO-INSTTYPE:3
2214 DESCRIPTION:REMINDER
2215 TRIGGER;RELATED=START:-PT15M
2220 "&15/5/2012 15:00-15:30 Query
2222 Organizer: MAILTO:a.luser@foo.com
2225 UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15
2228 ;; 2015-12-05, mixed line endings and empty lines, see Bug#22092.
2229 (icalendar-tests--test-import
2231 PRODID:-//www.norwegian.no//iCalendar MIMEDIR//EN\r
2236 SEQUENCE:1512040950\r
2237 DTSTAMP:20141204T095043Z\r
2238 ORGANIZER:noreply@norwegian.no\r
2239 DTSTART:20141208T173000Z\r
2241 DTEND:20141208T215500Z\r
2243 LOCATION:Stavanger-Sola\r
2245 DESCRIPTION:Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390\r
2247 X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"><html><head><META NAME=\"Generator\" CONTENT=\"MS Exchange Server version 08.00.0681.000\"><title></title></head><body><b><font face=\"Calibri\" size=\"3\">Reisereferanse</p></body></html>
2248 SUMMARY:Norwegian til Tromsoe-Langnes -\r
2250 CATEGORIES:Appointment\r
2261 "&2014/12/8 18:30-22:55 Norwegian til Tromsoe-Langnes -
2262 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390
2263 Location: Stavanger-Sola
2264 Organizer: noreply@norwegian.no
2268 "&8/12/2014 18:30-22:55 Norwegian til Tromsoe-Langnes -
2269 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390
2270 Location: Stavanger-Sola
2271 Organizer: noreply@norwegian.no
2275 "&12/8/2014 18:30-22:55 Norwegian til Tromsoe-Langnes -
2276 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Tromsø 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Tromsø 8. des 2014 21:00, DY390
2277 Location: Stavanger-Sola
2278 Organizer: noreply@norwegian.no
2285 (provide 'icalendar-tests
)
2286 ;;; icalendar-tests.el ends here