]> code.delx.au - gnu-emacs/blob - test/lisp/calendar/icalendar-tests.el
Merge from origin/emacs-25
[gnu-emacs] / test / lisp / calendar / icalendar-tests.el
1 ;; icalendar-tests.el --- Test suite for icalendar.el
2
3 ;; Copyright (C) 2005, 2008-2016 Free Software Foundation, Inc.
4
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
6 ;; Created: March 2005
7 ;; Keywords: calendar
8 ;; Human-Keywords: calendar, diary, iCalendar, vCalendar
9
10 ;; This file is part of GNU Emacs.
11
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.
16
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.
21
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/>.
24
25 ;;; Commentary:
26
27 ;; TODO:
28 ;; - Add more unit tests for functions, timezone etc.
29
30 ;; Note: Watch the trailing blank that is added on import.
31
32 ;;; Code:
33
34 (require 'ert)
35 (require 'ert-x)
36 (require 'icalendar)
37
38 ;; ======================================================================
39 ;; Helpers
40 ;; ======================================================================
41
42 (defun icalendar-tests--get-ical-event (ical-string)
43 "Return iCalendar event for ICAL-STRING."
44 (save-excursion
45 (with-temp-buffer
46 (insert ical-string)
47 (goto-char (point-min))
48 (car (icalendar--read-element nil nil)))))
49
50 (defun icalendar-tests--trim (string)
51 "Remove leading and trailing whitespace from STRING."
52 (replace-regexp-in-string "[ \t\n]+\\'" ""
53 (replace-regexp-in-string "\\`[ \t\n]+" "" string)))
54
55 ;; ======================================================================
56 ;; Tests of functions
57 ;; ======================================================================
58
59 (ert-deftest icalendar--create-uid ()
60 "Test for `icalendar--create-uid'."
61 (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s")
62 (icalendar--uid-count 77)
63 (entry-full "30.06.1964 07:01 blahblah")
64 (hash (format "%d" (abs (sxhash entry-full))))
65 (contents "DTSTART:19640630T070100\nblahblah")
66 (username (or user-login-name "UNKNOWN_USER")))
67 (ert-with-function-mocked current-time (lambda () '(1 2 3))
68 (should (= 77 icalendar--uid-count))
69 (should (string= (concat "xxx-123-77-" hash "-" username "-19640630")
70 (icalendar--create-uid entry-full contents)))
71 (should (= 78 icalendar--uid-count)))
72 (setq contents "blahblah")
73 (setq icalendar-uid-format "yyy%syyy")
74 (should (string= (concat "yyyDTSTARTyyy")
75 (icalendar--create-uid entry-full contents)))))
76
77 (ert-deftest icalendar-convert-anniversary-to-ical ()
78 "Test method for `icalendar--convert-anniversary-to-ical'."
79 (let* ((calendar-date-style 'iso)
80 result)
81 (setq result (icalendar--convert-anniversary-to-ical
82 "" "%%(diary-anniversary 1964 6 30) g"))
83 (should (consp result))
84 (should (string= (concat
85 "\nDTSTART;VALUE=DATE:19640630"
86 "\nDTEND;VALUE=DATE:19640701"
87 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
88 (car result)))
89 (should (string= "g" (cdr result)))))
90
91 (ert-deftest icalendar--convert-cyclic-to-ical ()
92 "Test method for `icalendar--convert-cyclic-to-ical'."
93 (let* ((calendar-date-style 'iso)
94 result)
95 (setq result (icalendar--convert-block-to-ical
96 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
97 (should (consp result))
98 (should (string= (concat
99 "\nDTSTART;VALUE=DATE:20040719"
100 "\nDTEND;VALUE=DATE:20040828")
101 (car result)))
102 (should (string= "Sommerferien" (cdr result)))))
103
104 (ert-deftest icalendar--convert-block-to-ical ()
105 "Test method for `icalendar--convert-block-to-ical'."
106 (let* ((calendar-date-style 'iso)
107 result)
108 (setq result (icalendar--convert-block-to-ical
109 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
110 (should (consp result))
111 (should (string= (concat
112 "\nDTSTART;VALUE=DATE:20040719"
113 "\nDTEND;VALUE=DATE:20040828")
114 (car result)))
115 (should (string= "Sommerferien" (cdr result)))))
116
117 (ert-deftest icalendar--convert-yearly-to-ical ()
118 "Test method for `icalendar--convert-yearly-to-ical'."
119 (let* ((calendar-date-style 'iso)
120 result
121 (calendar-month-name-array
122 ["January" "February" "March" "April" "May" "June" "July" "August"
123 "September" "October" "November" "December"]))
124 (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
125 (should (consp result))
126 (should (string= (concat
127 "\nDTSTART;VALUE=DATE:19000501"
128 "\nDTEND;VALUE=DATE:19000502"
129 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
130 (car result)))
131 (should (string= "Tag der Arbeit" (cdr result)))))
132
133 (ert-deftest icalendar--convert-weekly-to-ical ()
134 "Test method for `icalendar--convert-weekly-to-ical'."
135 (let* ((calendar-date-style 'iso)
136 result
137 (calendar-day-name-array
138 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
139 "Saturday"]))
140 (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
141 (should (consp result))
142 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
143 "\nDTEND;VALUE=DATE-TIME:20050103T093000"
144 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
145 (car result)))
146 (should (string= "subject" (cdr result)))))
147
148 (ert-deftest icalendar--convert-sexp-to-ical ()
149 "Test method for `icalendar--convert-sexp-to-ical'."
150 (let* (result
151 (icalendar-export-sexp-enumeration-days 3))
152 ;; test case %%(diary-hebrew-date)
153 (setq result (icalendar--convert-sexp-to-ical "" "%%(diary-hebrew-date)"))
154 (should (consp result))
155 (should (eq icalendar-export-sexp-enumeration-days (length result)))
156 (mapc (lambda (i)
157 (should (consp i))
158 (should (string-match "Hebrew date (until sunset): .*" (cdr i))))
159 result)))
160
161 (ert-deftest icalendar--convert-to-ical ()
162 "Test method for `icalendar--convert-to-ical'."
163 (let* (result
164 (icalendar-export-sexp-enumerate-all t)
165 (icalendar-export-sexp-enumeration-days 3)
166 (calendar-date-style 'iso))
167 ;; test case: %%(diary-anniversary 1642 12 25) Newton
168 ;; forced enumeration not matching the actual day --> empty
169 (setq result (icalendar--convert-sexp-to-ical
170 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
171 (encode-time 1 1 1 6 12 2014)))
172 (should (null result))
173 ;; test case: %%(diary-anniversary 1642 12 25) Newton
174 ;; enumeration does match the actual day -->
175 (setq result (icalendar--convert-sexp-to-ical
176 "" "%%(diary-anniversary 1642 12 25) Newton's birthday"
177 (encode-time 1 1 1 24 12 2014)))
178 (should (= 1 (length result)))
179 (should (consp (car result)))
180 (should (string-match
181 "\nDTSTART;VALUE=DATE:20141225\nDTEND;VALUE=DATE:20141226"
182 (car (car result))))
183 (should (string-match "Newton's birthday" (cdr (car result))))))
184
185 (ert-deftest icalendar--parse-vtimezone ()
186 "Test method for `icalendar--parse-vtimezone'."
187 (let (vtimezone result)
188 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
189 TZID:thename
190 BEGIN:STANDARD
191 DTSTART:16010101T040000
192 TZOFFSETFROM:+0300
193 TZOFFSETTO:+0200
194 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
195 END:STANDARD
196 BEGIN:DAYLIGHT
197 DTSTART:16010101T030000
198 TZOFFSETFROM:+0200
199 TZOFFSETTO:+0300
200 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
201 END:DAYLIGHT
202 END:VTIMEZONE
203 "))
204 (setq result (icalendar--parse-vtimezone vtimezone))
205 (should (string= "thename" (car result)))
206 (message (cdr result))
207 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
208 (cdr result)))
209 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
210 TZID:anothername, with a comma
211 BEGIN:STANDARD
212 DTSTART:16010101T040000
213 TZOFFSETFROM:+0300
214 TZOFFSETTO:+0200
215 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
216 END:STANDARD
217 BEGIN:DAYLIGHT
218 DTSTART:16010101T030000
219 TZOFFSETFROM:+0200
220 TZOFFSETTO:+0300
221 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
222 END:DAYLIGHT
223 END:VTIMEZONE
224 "))
225 (setq result (icalendar--parse-vtimezone vtimezone))
226 (should (string= "anothername, with a comma" (car result)))
227 (message (cdr result))
228 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
229 (cdr result)))
230 ;; offsetfrom = offsetto
231 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
232 TZID:Kolkata, Chennai, Mumbai, New Delhi
233 X-MICROSOFT-CDO-TZID:23
234 BEGIN:STANDARD
235 DTSTART:16010101T000000
236 TZOFFSETFROM:+0530
237 TZOFFSETTO:+0530
238 END:STANDARD
239 BEGIN:DAYLIGHT
240 DTSTART:16010101T000000
241 TZOFFSETFROM:+0530
242 TZOFFSETTO:+0530
243 END:DAYLIGHT
244 END:VTIMEZONE
245 "))
246 (setq result (icalendar--parse-vtimezone vtimezone))
247 (should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result)))
248 (message (cdr result))
249 (should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00"
250 (cdr result)))))
251
252 (ert-deftest icalendar--convert-ordinary-to-ical ()
253 "Test method for `icalendar--convert-ordinary-to-ical'."
254 (let* ((calendar-date-style 'iso)
255 result)
256 ;; without time
257 (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
258 (should (consp result))
259 (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
260 (car result)))
261 (should (string= "subject" (cdr result)))
262
263 ;; with start time
264 (setq result (icalendar--convert-ordinary-to-ical
265 "&?" "&2010 2 15 12:34 s"))
266 (should (consp result))
267 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
268 "\nDTEND;VALUE=DATE-TIME:20100215T133400")
269 (car result)))
270 (should (string= "s" (cdr result)))
271
272 ;; with time
273 (setq result (icalendar--convert-ordinary-to-ical
274 "&?" "&2010 2 15 12:34-23:45 s"))
275 (should (consp result))
276 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
277 "\nDTEND;VALUE=DATE-TIME:20100215T234500")
278 (car result)))
279 (should (string= "s" (cdr result)))
280
281 ;; with time, again -- test bug#5549
282 (setq result (icalendar--convert-ordinary-to-ical
283 "x?" "x2010 2 15 0:34-1:45 s"))
284 (should (consp result))
285 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
286 "\nDTEND;VALUE=DATE-TIME:20100215T014500")
287 (car result)))
288 (should (string= "s" (cdr result)))))
289
290 (ert-deftest icalendar--diarytime-to-isotime ()
291 "Test method for `icalendar--diarytime-to-isotime'."
292 (should (string= "T011500"
293 (icalendar--diarytime-to-isotime "01:15" "")))
294 (should (string= "T011500"
295 (icalendar--diarytime-to-isotime "1:15" "")))
296 (should (string= "T000100"
297 (icalendar--diarytime-to-isotime "0:01" "")))
298 (should (string= "T010000"
299 (icalendar--diarytime-to-isotime "0100" "")))
300 (should (string= "T010000"
301 (icalendar--diarytime-to-isotime "0100" "am")))
302 (should (string= "T130000"
303 (icalendar--diarytime-to-isotime "0100" "pm")))
304 (should (string= "T120000"
305 (icalendar--diarytime-to-isotime "1200" "")))
306 (should (string= "T171700"
307 (icalendar--diarytime-to-isotime "17:17" "")))
308 (should (string= "T000000"
309 (icalendar--diarytime-to-isotime "1200" "am")))
310 (should (string= "T000100"
311 (icalendar--diarytime-to-isotime "1201" "am")))
312 (should (string= "T005900"
313 (icalendar--diarytime-to-isotime "1259" "am")))
314 (should (string= "T120000"
315 (icalendar--diarytime-to-isotime "1200" "pm")))
316 (should (string= "T120100"
317 (icalendar--diarytime-to-isotime "1201" "pm")))
318 (should (string= "T125900"
319 (icalendar--diarytime-to-isotime "1259" "pm")))
320 (should (string= "T150000"
321 (icalendar--diarytime-to-isotime "3" "pm"))))
322
323 (ert-deftest icalendar--datetime-to-diary-date ()
324 "Test method for `icalendar--datetime-to-diary-date'."
325 (let* ((datetime '(59 59 23 31 12 2008))
326 (calendar-date-style 'iso))
327 (should (string= "2008 12 31"
328 (icalendar--datetime-to-diary-date datetime)))
329 (setq calendar-date-style 'european)
330 (should (string= "31 12 2008"
331 (icalendar--datetime-to-diary-date datetime)))
332 (setq calendar-date-style 'american)
333 (should (string= "12 31 2008"
334 (icalendar--datetime-to-diary-date datetime)))))
335
336 (ert-deftest icalendar--datestring-to-isodate ()
337 "Test method for `icalendar--datestring-to-isodate'."
338 (let ((calendar-date-style 'iso))
339 ;; numeric iso
340 (should (string= "20080511"
341 (icalendar--datestring-to-isodate "2008 05 11")))
342 (should (string= "20080531"
343 (icalendar--datestring-to-isodate "2008 05 31")))
344 (should (string= "20080602"
345 (icalendar--datestring-to-isodate "2008 05 31" 2)))
346
347 ;; numeric european
348 (setq calendar-date-style 'european)
349 (should (string= "20080511"
350 (icalendar--datestring-to-isodate "11 05 2008")))
351 (should (string= "20080531"
352 (icalendar--datestring-to-isodate "31 05 2008")))
353 (should (string= "20080602"
354 (icalendar--datestring-to-isodate "31 05 2008" 2)))
355
356 ;; numeric american
357 (setq calendar-date-style 'american)
358 (should (string= "20081105"
359 (icalendar--datestring-to-isodate "11 05 2008")))
360 (should (string= "20081230"
361 (icalendar--datestring-to-isodate "12 30 2008")))
362 (should (string= "20090101"
363 (icalendar--datestring-to-isodate "12 30 2008" 2)))
364
365 ;; non-numeric
366 (setq calendar-date-style nil) ;not necessary for conversion
367 (should (string= "20081105"
368 (icalendar--datestring-to-isodate "Nov 05 2008")))
369 (should (string= "20081105"
370 (icalendar--datestring-to-isodate "05 Nov 2008")))
371 (should (string= "20081105"
372 (icalendar--datestring-to-isodate "2008 Nov 05")))))
373
374 (ert-deftest icalendar--first-weekday-of-year ()
375 "Test method for `icalendar-first-weekday-of-year'."
376 (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
377 (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
378 (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
379 (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
380 (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
381 (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
382 (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
383 (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
384 (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
385
386 (ert-deftest icalendar--import-format-sample ()
387 "Test method for `icalendar-import-format-sample'."
388 (should (string= (concat "SUMMARY='a' DESCRIPTION='b' LOCATION='c' "
389 "ORGANIZER='d' STATUS='' URL='' CLASS=''")
390 (icalendar-import-format-sample
391 (icalendar-tests--get-ical-event "BEGIN:VEVENT
392 DTSTAMP:20030509T043439Z
393 DTSTART:20030509T103000
394 SUMMARY:a
395 ORGANIZER:d
396 LOCATION:c
397 DTEND:20030509T153000
398 DESCRIPTION:b
399 END:VEVENT
400 ")))))
401
402 (ert-deftest icalendar--format-ical-event ()
403 "Test `icalendar--format-ical-event'."
404 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
405 (icalendar-import-format-summary "SUM %s")
406 (icalendar-import-format-location " LOC %s")
407 (icalendar-import-format-description " DES %s")
408 (icalendar-import-format-organizer " ORG %s")
409 (icalendar-import-format-status " STA %s")
410 (icalendar-import-format-url " URL %s")
411 (icalendar-import-format-class " CLA %s")
412 (event (icalendar-tests--get-ical-event "BEGIN:VEVENT
413 DTSTAMP:20030509T043439Z
414 DTSTART:20030509T103000
415 SUMMARY:sum
416 ORGANIZER:org
417 LOCATION:loc
418 DTEND:20030509T153000
419 DESCRIPTION:des
420 END:VEVENT
421 ")))
422 (should (string= "SUM sum DES des LOC loc ORG org"
423 (icalendar--format-ical-event event)))
424 (setq icalendar-import-format (lambda (&rest ignore)
425 "helloworld"))
426 (should (string= "helloworld" (icalendar--format-ical-event event)))
427 (setq icalendar-import-format
428 (lambda (e)
429 (format "-%s-%s-%s-%s-%s-%s-%s-"
430 (icalendar--get-event-property event 'SUMMARY)
431 (icalendar--get-event-property event 'DESCRIPTION)
432 (icalendar--get-event-property event 'LOCATION)
433 (icalendar--get-event-property event 'ORGANIZER)
434 (icalendar--get-event-property event 'STATUS)
435 (icalendar--get-event-property event 'URL)
436 (icalendar--get-event-property event 'CLASS))))
437 (should (string= "-sum-des-loc-org-nil-nil-nil-"
438 (icalendar--format-ical-event event)))))
439
440 (ert-deftest icalendar--parse-summary-and-rest ()
441 "Test `icalendar--parse-summary-and-rest'."
442 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
443 (icalendar-import-format-summary "SUM %s")
444 (icalendar-import-format-location " LOC %s")
445 (icalendar-import-format-description " DES %s")
446 (icalendar-import-format-organizer " ORG %s")
447 (icalendar-import-format-status " STA %s")
448 (icalendar-import-format-url " URL %s")
449 (icalendar-import-format-class " CLA %s")
450 (result))
451 (setq result (icalendar--parse-summary-and-rest "SUM sum ORG org"))
452 (should (string= "org" (cdr (assoc 'org result))))
453
454 (setq result (icalendar--parse-summary-and-rest
455 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
456 (should (string= "des" (cdr (assoc 'des result))))
457 (should (string= "loc" (cdr (assoc 'loc result))))
458 (should (string= "org" (cdr (assoc 'org result))))
459 (should (string= "sta" (cdr (assoc 'sta result))))
460 (should (string= "cla" (cdr (assoc 'cla result))))
461
462 (setq icalendar-import-format (lambda () "Hello world"))
463 (setq result (icalendar--parse-summary-and-rest
464 "blah blah "))
465 (should (not result))
466 ))
467
468 (ert-deftest icalendar--decode-isodatetime ()
469 "Test `icalendar--decode-isodatetime'."
470 (let ((tz (getenv "TZ"))
471 result)
472 (unwind-protect
473 (progn
474 ;; Use Eastern European Time (UTC+2, UTC+3 daylight saving)
475 (setenv "TZ" "EET-2EEST,M3.5.0/3,M10.5.0/4")
476
477 (message "%s" (current-time-zone (encode-time 0 0 10 1 1 2013 0)))
478 (message "%s" (current-time-zone (encode-time 0 0 10 1 8 2013 0)))
479
480 ;; testcase: no time zone in input -> keep time as is
481 ;; 1 Jan 2013 10:00
482 (should (equal '(0 0 10 1 1 2013 2 nil 7200)
483 (icalendar--decode-isodatetime "20130101T100000")))
484 ;; 1 Aug 2013 10:00 (DST)
485 (should (equal '(0 0 10 1 8 2013 4 t 10800)
486 (icalendar--decode-isodatetime "20130801T100000")))
487
488 ;; testcase: UTC time zone specifier in input -> convert to local time
489 ;; 31 Dec 2013 23:00 UTC -> 1 Jan 2013 01:00 EET
490 (should (equal '(0 0 1 1 1 2014 3 nil 7200)
491 (icalendar--decode-isodatetime "20131231T230000Z")))
492 ;; 1 Aug 2013 10:00 UTC -> 1 Aug 2013 13:00 EEST
493 (should (equal '(0 0 13 1 8 2013 4 t 10800)
494 (icalendar--decode-isodatetime "20130801T100000Z")))
495
496 )
497 ;; restore time-zone even if something went terribly wrong
498 (setenv "TZ" tz))) )
499
500 ;; ======================================================================
501 ;; Export tests
502 ;; ======================================================================
503
504 (defun icalendar-tests--test-export (input-iso input-european input-american
505 expected-output &optional alarms)
506 "Perform an export test.
507 Argument INPUT-ISO iso style diary string.
508 Argument INPUT-EUROPEAN european style diary string.
509 Argument INPUT-AMERICAN american style diary string.
510 Argument EXPECTED-OUTPUT expected iCalendar result string.
511 Optional argument ALARMS the value of `icalendar-export-alarms' for this test.
512
513 European style input data must use german month names. American
514 and ISO style input data must use english month names."
515 (let ((tz (getenv "TZ"))
516 (calendar-date-style 'iso)
517 (icalendar-recurring-start-year 2000)
518 (icalendar-export-alarms alarms))
519 (unwind-protect
520 (progn
521 ;;; (message "Current time zone: %s" (current-time-zone))
522 ;; Use this form so as not to rely on system tz database.
523 ;; Eg hydra.nixos.org.
524 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
525 ;;; (message "Current time zone: %s" (current-time-zone))
526 (when input-iso
527 (let ((calendar-month-name-array
528 ["January" "February" "March" "April" "May" "June" "July" "August"
529 "September" "October" "November" "December"])
530 (calendar-day-name-array
531 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
532 "Saturday"]))
533 (setq calendar-date-style 'iso)
534 (icalendar-tests--do-test-export input-iso expected-output)))
535 (when input-european
536 (let ((calendar-month-name-array
537 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
538 "September" "Oktober" "November" "Dezember"])
539 (calendar-day-name-array
540 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
541 "Samstag"]))
542 (setq calendar-date-style 'european)
543 (icalendar-tests--do-test-export input-european expected-output)))
544 (when input-american
545 (let ((calendar-month-name-array
546 ["January" "February" "March" "April" "May" "June" "July" "August"
547 "September" "October" "November" "December"])
548 (calendar-day-name-array
549 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
550 "Saturday"]))
551 (setq calendar-date-style 'american)
552 (icalendar-tests--do-test-export input-american expected-output))))
553 ;; restore time-zone even if something went terribly wrong
554 (setenv "TZ" tz))))
555
556 (defun icalendar-tests--do-test-export (input expected-output)
557 "Actually perform export test.
558 Argument INPUT input diary string.
559 Argument EXPECTED-OUTPUT expected iCalendar result string."
560 (let ((temp-file (make-temp-file "icalendar-tests-ics")))
561 (unwind-protect
562 (progn
563 (with-temp-buffer
564 (insert input)
565 (icalendar-export-region (point-min) (point-max) temp-file))
566 (save-excursion
567 (find-file temp-file)
568 (goto-char (point-min))
569 (cond (expected-output
570 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
571 PRODID:-//Emacs//NONSGML icalendar.el//EN
572 VERSION:2.0
573 BEGIN:VEVENT
574 UID:emacs[0-9]+
575 \\(\\(.\\|\n\\)+\\)
576 END:VEVENT
577 END:VCALENDAR
578 \\s-*$"
579 nil t))
580 (should (string-match
581 (concat "^\\s-*"
582 (regexp-quote (buffer-substring-no-properties
583 (match-beginning 1) (match-end 1)))
584 "\\s-*$")
585 expected-output)))
586 (t
587 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
588 PRODID:-//Emacs//NONSGML icalendar.el//EN
589 VERSION:2.0
590 END:VCALENDAR
591 \\s-*$"
592 nil t))))))
593 ;; cleanup!!
594 (kill-buffer (find-buffer-visiting temp-file))
595 (delete-file temp-file))))
596
597 (ert-deftest icalendar-export-ordinary-no-time ()
598 "Perform export test."
599
600 (let ((icalendar-export-hidden-diary-entries nil))
601 (icalendar-tests--test-export
602 "&2000 Oct 3 ordinary no time "
603 "&3 Okt 2000 ordinary no time "
604 "&Oct 3 2000 ordinary no time "
605 nil))
606
607 (icalendar-tests--test-export
608 "2000 Oct 3 ordinary no time "
609 "3 Okt 2000 ordinary no time "
610 "Oct 3 2000 ordinary no time "
611 "DTSTART;VALUE=DATE:20001003
612 DTEND;VALUE=DATE:20001004
613 SUMMARY:ordinary no time
614 "))
615
616 (ert-deftest icalendar-export-ordinary ()
617 "Perform export test."
618
619 (icalendar-tests--test-export
620 "2000 Oct 3 16:30 ordinary with time"
621 "3 Okt 2000 16:30 ordinary with time"
622 "Oct 3 2000 16:30 ordinary with time"
623 "DTSTART;VALUE=DATE-TIME:20001003T163000
624 DTEND;VALUE=DATE-TIME:20001003T173000
625 SUMMARY:ordinary with time
626 ")
627 (icalendar-tests--test-export
628 "2000 10 3 16:30 ordinary with time 2"
629 "3 10 2000 16:30 ordinary with time 2"
630 "10 3 2000 16:30 ordinary with time 2"
631 "DTSTART;VALUE=DATE-TIME:20001003T163000
632 DTEND;VALUE=DATE-TIME:20001003T173000
633 SUMMARY:ordinary with time 2
634 ")
635
636 (icalendar-tests--test-export
637 "2000/10/3 16:30 ordinary with time 3"
638 "3/10/2000 16:30 ordinary with time 3"
639 "10/3/2000 16:30 ordinary with time 3"
640 "DTSTART;VALUE=DATE-TIME:20001003T163000
641 DTEND;VALUE=DATE-TIME:20001003T173000
642 SUMMARY:ordinary with time 3
643 "))
644
645 (ert-deftest icalendar-export-multiline ()
646 "Perform export test."
647
648 ;; multiline -- FIXME!!!
649 (icalendar-tests--test-export
650 "2000 October 3 16:30 multiline
651 17:30 multiline continued FIXME"
652 "3 Oktober 2000 16:30 multiline
653 17:30 multiline continued FIXME"
654 "October 3 2000 16:30 multiline
655 17:30 multiline continued FIXME"
656 "DTSTART;VALUE=DATE-TIME:20001003T163000
657 DTEND;VALUE=DATE-TIME:20001003T173000
658 SUMMARY:multiline
659 DESCRIPTION:
660 17:30 multiline continued FIXME
661 "))
662
663 (ert-deftest icalendar-export-weekly-by-day ()
664 "Perform export test."
665
666 ;; weekly by day
667 (icalendar-tests--test-export
668 "Monday 1:30pm weekly by day with start time"
669 "Montag 13:30 weekly by day with start time"
670 "Monday 1:30pm weekly by day with start time"
671 "DTSTART;VALUE=DATE-TIME:20000103T133000
672 DTEND;VALUE=DATE-TIME:20000103T143000
673 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
674 SUMMARY:weekly by day with start time
675 ")
676
677 (icalendar-tests--test-export
678 "Monday 13:30-15:00 weekly by day with start and end time"
679 "Montag 13:30-15:00 weekly by day with start and end time"
680 "Monday 01:30pm-03:00pm weekly by day with start and end time"
681 "DTSTART;VALUE=DATE-TIME:20000103T133000
682 DTEND;VALUE=DATE-TIME:20000103T150000
683 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
684 SUMMARY:weekly by day with start and end time
685 "))
686
687 (ert-deftest icalendar-export-yearly ()
688 "Perform export test."
689 ;; yearly
690 (icalendar-tests--test-export
691 "may 1 yearly no time"
692 "1 Mai yearly no time"
693 "may 1 yearly no time"
694 "DTSTART;VALUE=DATE:19000501
695 DTEND;VALUE=DATE:19000502
696 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
697 SUMMARY:yearly no time
698 "))
699
700 (ert-deftest icalendar-export-anniversary ()
701 "Perform export test."
702 ;; anniversaries
703 (icalendar-tests--test-export
704 "%%(diary-anniversary 1989 10 3) anniversary no time"
705 "%%(diary-anniversary 3 10 1989) anniversary no time"
706 "%%(diary-anniversary 10 3 1989) anniversary no time"
707 "DTSTART;VALUE=DATE:19891003
708 DTEND;VALUE=DATE:19891004
709 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
710 SUMMARY:anniversary no time
711 ")
712 (icalendar-tests--test-export
713 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
714 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
715 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
716 "DTSTART;VALUE=DATE-TIME:19891003T190000
717 DTEND;VALUE=DATE-TIME:19891004T200000
718 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
719 SUMMARY:anniversary with time
720 "))
721
722 (ert-deftest icalendar-export-block ()
723 "Perform export test."
724 ;; block
725 (icalendar-tests--test-export
726 "%%(diary-block 2001 6 18 2001 7 6) block no time"
727 "%%(diary-block 18 6 2001 6 7 2001) block no time"
728 "%%(diary-block 6 18 2001 7 6 2001) block no time"
729 "DTSTART;VALUE=DATE:20010618
730 DTEND;VALUE=DATE:20010707
731 SUMMARY:block no time
732 ")
733 (icalendar-tests--test-export
734 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
735 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
736 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
737 "DTSTART;VALUE=DATE-TIME:20010618T130000
738 DTEND;VALUE=DATE-TIME:20010618T170000
739 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
740 SUMMARY:block with time
741 ")
742 (icalendar-tests--test-export
743 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
744 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
745 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
746 "DTSTART;VALUE=DATE-TIME:20010618T130000
747 DTEND;VALUE=DATE-TIME:20010618T140000
748 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
749 SUMMARY:block no end time
750 "))
751
752 (ert-deftest icalendar-export-alarms ()
753 "Perform export test with different settings for exporting alarms."
754 ;; no alarm
755 (icalendar-tests--test-export
756 "2014 Nov 17 19:30 no alarm"
757 "17 Nov 2014 19:30 no alarm"
758 "Nov 17 2014 19:30 no alarm"
759 "DTSTART;VALUE=DATE-TIME:20141117T193000
760 DTEND;VALUE=DATE-TIME:20141117T203000
761 SUMMARY:no alarm
762 "
763 nil)
764
765 ;; 10 minutes in advance, audio
766 (icalendar-tests--test-export
767 "2014 Nov 17 19:30 audio alarm"
768 "17 Nov 2014 19:30 audio alarm"
769 "Nov 17 2014 19:30 audio alarm"
770 "DTSTART;VALUE=DATE-TIME:20141117T193000
771 DTEND;VALUE=DATE-TIME:20141117T203000
772 SUMMARY:audio alarm
773 BEGIN:VALARM
774 ACTION:AUDIO
775 TRIGGER:-PT10M
776 END:VALARM
777 "
778 '(10 ((audio))))
779
780 ;; 20 minutes in advance, display
781 (icalendar-tests--test-export
782 "2014 Nov 17 19:30 display alarm"
783 "17 Nov 2014 19:30 display alarm"
784 "Nov 17 2014 19:30 display alarm"
785 "DTSTART;VALUE=DATE-TIME:20141117T193000
786 DTEND;VALUE=DATE-TIME:20141117T203000
787 SUMMARY:display alarm
788 BEGIN:VALARM
789 ACTION:DISPLAY
790 TRIGGER:-PT20M
791 DESCRIPTION:display alarm
792 END:VALARM
793 "
794 '(20 ((display))))
795
796 ;; 66 minutes in advance, email
797 (icalendar-tests--test-export
798 "2014 Nov 17 19:30 email alarm"
799 "17 Nov 2014 19:30 email alarm"
800 "Nov 17 2014 19:30 email alarm"
801 "DTSTART;VALUE=DATE-TIME:20141117T193000
802 DTEND;VALUE=DATE-TIME:20141117T203000
803 SUMMARY:email alarm
804 BEGIN:VALARM
805 ACTION:EMAIL
806 TRIGGER:-PT66M
807 DESCRIPTION:email alarm
808 SUMMARY:email alarm
809 ATTENDEE:MAILTO:att.one@email.com
810 ATTENDEE:MAILTO:att.two@email.com
811 END:VALARM
812 "
813 '(66 ((email ("att.one@email.com" "att.two@email.com")))))
814
815 ;; 2 minutes in advance, all alarms
816 (icalendar-tests--test-export
817 "2014 Nov 17 19:30 all alarms"
818 "17 Nov 2014 19:30 all alarms"
819 "Nov 17 2014 19:30 all alarms"
820 "DTSTART;VALUE=DATE-TIME:20141117T193000
821 DTEND;VALUE=DATE-TIME:20141117T203000
822 SUMMARY:all alarms
823 BEGIN:VALARM
824 ACTION:EMAIL
825 TRIGGER:-PT2M
826 DESCRIPTION:all alarms
827 SUMMARY:all alarms
828 ATTENDEE:MAILTO:att.one@email.com
829 ATTENDEE:MAILTO:att.two@email.com
830 END:VALARM
831 BEGIN:VALARM
832 ACTION:AUDIO
833 TRIGGER:-PT2M
834 END:VALARM
835 BEGIN:VALARM
836 ACTION:DISPLAY
837 TRIGGER:-PT2M
838 DESCRIPTION:all alarms
839 END:VALARM
840 "
841 '(2 ((email ("att.one@email.com" "att.two@email.com")) (audio) (display)))))
842
843 ;; ======================================================================
844 ;; Import tests
845 ;; ======================================================================
846
847 (defun icalendar-tests--test-import (input expected-iso expected-european
848 expected-american)
849 "Perform import test.
850 Argument INPUT icalendar event string.
851 Argument EXPECTED-ISO expected iso style diary string.
852 Argument EXPECTED-EUROPEAN expected european style diary string.
853 Argument EXPECTED-AMERICAN expected american style diary string.
854 During import test the timezone is set to Central European Time."
855 (let ((timezone (getenv "TZ")))
856 (unwind-protect
857 (progn
858 ;; Use this form so as not to rely on system tz database.
859 ;; Eg hydra.nixos.org.
860 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
861 (with-temp-buffer
862 (if (string-match "^BEGIN:VCALENDAR" input)
863 (insert input)
864 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
865 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
866 (insert input)
867 (unless (eq (char-before) ?\n)
868 (insert "\n"))
869 (insert "END:VEVENT\nEND:VCALENDAR\n"))
870 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
871 (icalendar-import-format-summary "%s")
872 (icalendar-import-format-location "\n Location: %s")
873 (icalendar-import-format-description "\n Desc: %s")
874 (icalendar-import-format-organizer "\n Organizer: %s")
875 (icalendar-import-format-status "\n Status: %s")
876 (icalendar-import-format-url "\n URL: %s")
877 (icalendar-import-format-class "\n Class: %s")
878 (icalendar-import-format-uid "\n UID: %s")
879 calendar-date-style)
880 (when expected-iso
881 (setq calendar-date-style 'iso)
882 (icalendar-tests--do-test-import input expected-iso))
883 (when expected-european
884 (setq calendar-date-style 'european)
885 (icalendar-tests--do-test-import input expected-european))
886 (when expected-american
887 (setq calendar-date-style 'american)
888 (icalendar-tests--do-test-import input expected-american)))))
889 (setenv "TZ" timezone))))
890
891 (defun icalendar-tests--do-test-import (input expected-output)
892 "Actually perform import test.
893 Argument INPUT input icalendar string.
894 Argument EXPECTED-OUTPUT expected diary string."
895 (let ((temp-file (make-temp-file "icalendar-test-diary")))
896 ;; Test the Catch-the-mysterious-coding-header logic below.
897 ;; Ruby-mode adds an after-save-hook which inserts the header!
898 ;; (save-excursion
899 ;; (find-file temp-file)
900 ;; (ruby-mode))
901 (icalendar-import-buffer temp-file t t)
902 (save-excursion
903 (find-file temp-file)
904 ;; Check for the mysterious "# coding: ..." header, remove it
905 ;; and give a shout
906 (goto-char (point-min))
907 (when (re-search-forward "# coding: .*?\n" nil t)
908 (message (concat "%s\n"
909 "Found mysterious \"# coding ...\" header! Removing it.\n"
910 "Current Modes: %s, %s\n"
911 "Current test: %s\n"
912 "%s")
913 (make-string 70 ?*)
914 major-mode
915 minor-mode-list
916 (ert-running-test)
917 (make-string 70 ?*))
918 (buffer-disable-undo)
919 (replace-match "")
920 (set-buffer-modified-p nil))
921
922 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
923 (should (string= expected-output result)))
924 (kill-buffer (find-buffer-visiting temp-file))
925 (delete-file temp-file))))
926
927 (ert-deftest icalendar-import-non-recurring ()
928 "Perform standard import tests."
929 (icalendar-tests--test-import
930 "SUMMARY:non-recurring
931 DTSTART;VALUE=DATE-TIME:20030919T090000
932 DTEND;VALUE=DATE-TIME:20030919T113000"
933 "&2003/9/19 09:00-11:30 non-recurring\n"
934 "&19/9/2003 09:00-11:30 non-recurring\n"
935 "&9/19/2003 09:00-11:30 non-recurring\n")
936 (icalendar-tests--test-import
937 "SUMMARY:non-recurring allday
938 DTSTART;VALUE=DATE-TIME:20030919"
939 "&2003/9/19 non-recurring allday\n"
940 "&19/9/2003 non-recurring allday\n"
941 "&9/19/2003 non-recurring allday\n")
942 (icalendar-tests--test-import
943 ;; Checkdoc removes trailing blanks. Therefore: format!
944 (format "%s\n%s\n%s" "SUMMARY:long " " summary"
945 "DTSTART;VALUE=DATE:20030919")
946 "&2003/9/19 long summary\n"
947 "&19/9/2003 long summary\n"
948 "&9/19/2003 long summary\n")
949 (icalendar-tests--test-import
950 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
951 SUMMARY:Sommerferien
952 STATUS:TENTATIVE
953 CLASS:PRIVATE
954 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
955 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
956 DTSTART;VALUE=DATE:20040719
957 DTEND;VALUE=DATE:20040828
958 DTSTAMP:20031103T011641Z
959 "
960 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
961 Status: TENTATIVE
962 Class: PRIVATE
963 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
964 "
965 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
966 Status: TENTATIVE
967 Class: PRIVATE
968 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
969 "
970 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
971 Status: TENTATIVE
972 Class: PRIVATE
973 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
974 ")
975 (icalendar-tests--test-import
976 "UID
977 :04979712-3902-11d9-93dd-8f9f4afe08da
978 SUMMARY
979 :folded summary
980 STATUS
981 :TENTATIVE
982 CLASS
983 :PRIVATE
984 X-MOZILLA-ALARM-DEFAULT-LENGTH
985 :0
986 DTSTART
987 :20041123T140000
988 DTEND
989 :20041123T143000
990 DTSTAMP
991 :20041118T013430Z
992 LAST-MODIFIED
993 :20041118T013640Z
994 "
995 "&2004/11/23 14:00-14:30 folded summary
996 Status: TENTATIVE
997 Class: PRIVATE
998 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
999 "&23/11/2004 14:00-14:30 folded summary
1000 Status: TENTATIVE
1001 Class: PRIVATE
1002 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
1003 "&11/23/2004 14:00-14:30 folded summary
1004 Status: TENTATIVE
1005 Class: PRIVATE
1006 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
1007
1008 (icalendar-tests--test-import
1009 "UID
1010 :6161a312-3902-11d9-b512-f764153bb28b
1011 SUMMARY
1012 :another example
1013 STATUS
1014 :TENTATIVE
1015 CLASS
1016 :PRIVATE
1017 X-MOZILLA-ALARM-DEFAULT-LENGTH
1018 :0
1019 DTSTART
1020 :20041123T144500
1021 DTEND
1022 :20041123T154500
1023 DTSTAMP
1024 :20041118T013641Z
1025 "
1026 "&2004/11/23 14:45-15:45 another example
1027 Status: TENTATIVE
1028 Class: PRIVATE
1029 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1030 "&23/11/2004 14:45-15:45 another example
1031 Status: TENTATIVE
1032 Class: PRIVATE
1033 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
1034 "&11/23/2004 14:45-15:45 another example
1035 Status: TENTATIVE
1036 Class: PRIVATE
1037 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
1038
1039 (ert-deftest icalendar-import-rrule ()
1040 (icalendar-tests--test-import
1041 "SUMMARY:rrule daily
1042 DTSTART;VALUE=DATE-TIME:20030919T090000
1043 DTEND;VALUE=DATE-TIME:20030919T113000
1044 RRULE:FREQ=DAILY;
1045 "
1046 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily\n"
1047 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily\n"
1048 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily\n")
1049 ;; RRULE examples
1050 (icalendar-tests--test-import
1051 "SUMMARY:rrule daily
1052 DTSTART;VALUE=DATE-TIME:20030919T090000
1053 DTEND;VALUE=DATE-TIME:20030919T113000
1054 RRULE:FREQ=DAILY;INTERVAL=2
1055 "
1056 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily\n"
1057 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily\n"
1058 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily\n")
1059 (icalendar-tests--test-import
1060 "SUMMARY:rrule daily with exceptions
1061 DTSTART;VALUE=DATE-TIME:20030919T090000
1062 DTEND;VALUE=DATE-TIME:20030919T113000
1063 RRULE:FREQ=DAILY;INTERVAL=2
1064 EXDATE:20030921,20030925
1065 "
1066 "&%%(and (not (diary-date 2003 9 25)) (not (diary-date 2003 9 21)) (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily with exceptions\n"
1067 "&%%(and (not (diary-date 25 9 2003)) (not (diary-date 21 9 2003)) (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily with exceptions\n"
1068 "&%%(and (not (diary-date 9 25 2003)) (not (diary-date 9 21 2003)) (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily with exceptions\n")
1069 (icalendar-tests--test-import
1070 "SUMMARY:rrule weekly
1071 DTSTART;VALUE=DATE-TIME:20030919T090000
1072 DTEND;VALUE=DATE-TIME:20030919T113000
1073 RRULE:FREQ=WEEKLY;
1074 "
1075 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly\n"
1076 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly\n"
1077 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly\n")
1078 (icalendar-tests--test-import
1079 "SUMMARY:rrule monthly no end
1080 DTSTART;VALUE=DATE-TIME:20030919T090000
1081 DTEND;VALUE=DATE-TIME:20030919T113000
1082 RRULE:FREQ=MONTHLY;
1083 "
1084 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end\n"
1085 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n"
1086 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n")
1087 (icalendar-tests--test-import
1088 "SUMMARY:rrule monthly with end
1089 DTSTART;VALUE=DATE-TIME:20030919T090000
1090 DTEND;VALUE=DATE-TIME:20030919T113000
1091 RRULE:FREQ=MONTHLY;UNTIL=20050819;
1092 "
1093 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end\n"
1094 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end\n"
1095 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end\n")
1096 (icalendar-tests--test-import
1097 "DTSTART;VALUE=DATE:20040815
1098 DTEND;VALUE=DATE:20040816
1099 SUMMARY:Maria Himmelfahrt
1100 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
1101 "
1102 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
1103 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt\n"
1104 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt\n")
1105 (icalendar-tests--test-import
1106 "SUMMARY:rrule yearly
1107 DTSTART;VALUE=DATE-TIME:20030919T090000
1108 DTEND;VALUE=DATE-TIME:20030919T113000
1109 RRULE:FREQ=YEARLY;INTERVAL=2
1110 "
1111 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly\n" ;FIXME
1112 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly\n" ;FIXME
1113 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly\n") ;FIXME
1114 (icalendar-tests--test-import
1115 "SUMMARY:rrule count daily short
1116 DTSTART;VALUE=DATE-TIME:20030919T090000
1117 DTEND;VALUE=DATE-TIME:20030919T113000
1118 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
1119 "
1120 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short\n"
1121 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short\n"
1122 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short\n")
1123 (icalendar-tests--test-import
1124 "SUMMARY:rrule count daily long
1125 DTSTART;VALUE=DATE-TIME:20030919T090000
1126 DTEND;VALUE=DATE-TIME:20030919T113000
1127 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
1128 "
1129 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long\n"
1130 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long\n"
1131 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long\n")
1132 (icalendar-tests--test-import
1133 "SUMMARY:rrule count bi-weekly 3 times
1134 DTSTART;VALUE=DATE-TIME:20030919T090000
1135 DTEND;VALUE=DATE-TIME:20030919T113000
1136 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
1137 "
1138 "&%%(and (diary-cyclic 14 2003 9 19) (diary-block 2003 9 19 2003 10 31)) 09:00-11:30 rrule count bi-weekly 3 times\n"
1139 "&%%(and (diary-cyclic 14 19 9 2003) (diary-block 19 9 2003 31 10 2003)) 09:00-11:30 rrule count bi-weekly 3 times\n"
1140 "&%%(and (diary-cyclic 14 9 19 2003) (diary-block 9 19 2003 10 31 2003)) 09:00-11:30 rrule count bi-weekly 3 times\n")
1141 (icalendar-tests--test-import
1142 "SUMMARY:rrule count monthly
1143 DTSTART;VALUE=DATE-TIME:20030919T090000
1144 DTEND;VALUE=DATE-TIME:20030919T113000
1145 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
1146 "
1147 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly\n"
1148 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly\n"
1149 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly\n")
1150 (icalendar-tests--test-import
1151 "SUMMARY:rrule count every second month
1152 DTSTART;VALUE=DATE-TIME:20030919T090000
1153 DTEND;VALUE=DATE-TIME:20030919T113000
1154 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
1155 "
1156 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month\n" ;FIXME
1157 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month\n" ;FIXME
1158 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month\n") ;FIXME
1159 (icalendar-tests--test-import
1160 "SUMMARY:rrule count yearly
1161 DTSTART;VALUE=DATE-TIME:20030919T090000
1162 DTEND;VALUE=DATE-TIME:20030919T113000
1163 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
1164 "
1165 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly\n"
1166 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly\n"
1167 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly\n")
1168 (icalendar-tests--test-import
1169 "SUMMARY:rrule count every second year
1170 DTSTART;VALUE=DATE-TIME:20030919T090000
1171 DTEND;VALUE=DATE-TIME:20030919T113000
1172 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
1173 "
1174 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year\n" ;FIXME!!!
1175 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year\n" ;FIXME!!!
1176 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year\n") ;FIXME!!!
1177 )
1178
1179 (ert-deftest icalendar-import-duration ()
1180 ;; duration
1181 (icalendar-tests--test-import
1182 "DTSTART;VALUE=DATE:20050217
1183 SUMMARY:duration
1184 DURATION:P7D
1185 "
1186 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration\n"
1187 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration\n"
1188 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration\n")
1189 (icalendar-tests--test-import
1190 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
1191 DTSTAMP:20041127T183315Z
1192 LAST-MODIFIED:20041127T183329
1193 SUMMARY:Urlaub
1194 DTSTART;VALUE=DATE:20011221
1195 DTEND;VALUE=DATE:20011221
1196 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
1197 CLASS:PUBLIC
1198 SEQUENCE:1
1199 CREATED:20041127T183329
1200 "
1201 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
1202 Class: PUBLIC
1203 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1204 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
1205 Class: PUBLIC
1206 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
1207 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
1208 Class: PUBLIC
1209 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
1210
1211 (ert-deftest icalendar-import-bug-6766 ()
1212 ;;bug#6766 -- multiple byday values in a weekly rrule
1213 (icalendar-tests--test-import
1214 "CLASS:PUBLIC
1215 DTEND;TZID=America/New_York:20100421T120000
1216 DTSTAMP:20100525T141214Z
1217 DTSTART;TZID=America/New_York:20100421T113000
1218 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
1219 SEQUENCE:1
1220 STATUS:CONFIRMED
1221 SUMMARY:Scrum
1222 TRANSP:OPAQUE
1223 UID:8814e3f9-7482-408f-996c-3bfe486a1262
1224 END:VEVENT
1225 BEGIN:VEVENT
1226 CLASS:PUBLIC
1227 DTSTAMP:20100525T141214Z
1228 DTSTART;VALUE=DATE:20100422
1229 DTEND;VALUE=DATE:20100423
1230 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
1231 SEQUENCE:1
1232 SUMMARY:Tues + Thurs thinking
1233 TRANSP:OPAQUE
1234 UID:8814e3f9-7482-408f-996c-3bfe486a1263
1235 "
1236 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1237 Status: CONFIRMED
1238 Class: PUBLIC
1239 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1240 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1241 Class: PUBLIC
1242 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1243 "
1244 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1245 Status: CONFIRMED
1246 Class: PUBLIC
1247 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1248 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1249 Class: PUBLIC
1250 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1251 "
1252 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1253 Status: CONFIRMED
1254 Class: PUBLIC
1255 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1256 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1257 Class: PUBLIC
1258 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1259 "))
1260
1261 (ert-deftest icalendar-import-multiple-vcalendars ()
1262 (icalendar-tests--test-import
1263 "DTSTART;VALUE=DATE:20110723
1264 SUMMARY:event-1
1265 "
1266 "&2011/7/23 event-1\n"
1267 "&23/7/2011 event-1\n"
1268 "&7/23/2011 event-1\n")
1269
1270 (icalendar-tests--test-import
1271 "BEGIN:VCALENDAR
1272 PRODID:-//Emacs//NONSGML icalendar.el//EN
1273 VERSION:2.0\nBEGIN:VEVENT
1274 DTSTART;VALUE=DATE:20110723
1275 SUMMARY:event-1
1276 END:VEVENT
1277 END:VCALENDAR
1278 BEGIN:VCALENDAR
1279 PRODID:-//Emacs//NONSGML icalendar.el//EN
1280 VERSION:2.0
1281 BEGIN:VEVENT
1282 DTSTART;VALUE=DATE:20110724
1283 SUMMARY:event-2
1284 END:VEVENT
1285 END:VCALENDAR
1286 BEGIN:VCALENDAR
1287 PRODID:-//Emacs//NONSGML icalendar.el//EN
1288 VERSION:2.0
1289 BEGIN:VEVENT
1290 DTSTART;VALUE=DATE:20110725
1291 SUMMARY:event-3a
1292 END:VEVENT
1293 BEGIN:VEVENT
1294 DTSTART;VALUE=DATE:20110725
1295 SUMMARY:event-3b
1296 END:VEVENT
1297 END:VCALENDAR
1298 "
1299 "&2011/7/23 event-1\n&2011/7/24 event-2\n&2011/7/25 event-3a\n&2011/7/25 event-3b\n"
1300 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
1301 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
1302
1303 (ert-deftest icalendar-import-with-uid ()
1304 "Perform import test with uid."
1305 (icalendar-tests--test-import
1306 "UID:1234567890uid
1307 SUMMARY:non-recurring
1308 DTSTART;VALUE=DATE-TIME:20030919T090000
1309 DTEND;VALUE=DATE-TIME:20030919T113000"
1310 "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1311 "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1312 "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
1313
1314 (ert-deftest icalendar-import-with-timezone ()
1315 ;; This is known to fail on MS-Windows, because the test assumes
1316 ;; Posix features of specifying DST rules.
1317 :expected-result (if (memq system-type '(windows-nt ms-dos))
1318 :failed
1319 :passed)
1320 ;; bug#11473
1321 (icalendar-tests--test-import
1322 "BEGIN:VCALENDAR
1323 BEGIN:VTIMEZONE
1324 TZID:fictional, nonexistent, arbitrary
1325 BEGIN:STANDARD
1326 DTSTART:20100101T000000
1327 TZOFFSETFROM:+0200
1328 TZOFFSETTO:-0200
1329 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01
1330 END:STANDARD
1331 BEGIN:DAYLIGHT
1332 DTSTART:20101201T000000
1333 TZOFFSETFROM:-0200
1334 TZOFFSETTO:+0200
1335 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
1336 END:DAYLIGHT
1337 END:VTIMEZONE
1338 BEGIN:VEVENT
1339 SUMMARY:standardtime
1340 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000
1341 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000
1342 END:VEVENT
1343 BEGIN:VEVENT
1344 SUMMARY:daylightsavingtime
1345 DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000
1346 DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000
1347 END:VEVENT
1348 END:VCALENDAR"
1349 ;; "standardtime" begins first sunday in january and is 4 hours behind CET
1350 ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET
1351 "&2012/1/15 15:00-15:30 standardtime
1352 &2012/12/15 11:00-11:30 daylightsavingtime
1353 "
1354 nil
1355 nil)
1356 )
1357 ;; ======================================================================
1358 ;; Cycle
1359 ;; ======================================================================
1360 (defun icalendar-tests--test-cycle (input)
1361 "Perform cycle test.
1362 Argument INPUT icalendar event string."
1363 (with-temp-buffer
1364 (if (string-match "^BEGIN:VCALENDAR" input)
1365 (insert input)
1366 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
1367 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
1368 (insert input)
1369 (unless (eq (char-before) ?\n)
1370 (insert "\n"))
1371 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1372 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
1373 (icalendar-import-format-summary "%s")
1374 (icalendar-import-format-location "\n Location: %s")
1375 (icalendar-import-format-description "\n Desc: %s")
1376 (icalendar-import-format-organizer "\n Organizer: %s")
1377 (icalendar-import-format-status "\n Status: %s")
1378 (icalendar-import-format-url "\n URL: %s")
1379 (icalendar-import-format-class "\n Class: %s")
1380 (icalendar-import-format-class "\n UID: %s")
1381 (icalendar-export-alarms nil))
1382 (dolist (calendar-date-style '(iso european american))
1383 (icalendar-tests--do-test-cycle)))))
1384
1385 (defun icalendar-tests--do-test-cycle ()
1386 "Actually perform import/export cycle test."
1387 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
1388 (temp-ics (make-temp-file "icalendar-test-ics"))
1389 (org-input (buffer-substring-no-properties (point-min) (point-max))))
1390
1391 (unwind-protect
1392 (progn
1393 ;; step 1: import
1394 (icalendar-import-buffer temp-diary t t)
1395
1396 ;; step 2: export what was just imported
1397 (save-excursion
1398 (find-file temp-diary)
1399 (icalendar-export-region (point-min) (point-max) temp-ics))
1400
1401 ;; compare the output of step 2 with the input of step 1
1402 (save-excursion
1403 (find-file temp-ics)
1404 (goto-char (point-min))
1405 ;;(when (re-search-forward "\nUID:.*\n" nil t)
1406 ;;(replace-match "\n"))
1407 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1408 (should (string= org-input cycled)))))
1409 ;; clean up
1410 (kill-buffer (find-buffer-visiting temp-diary))
1411 (with-current-buffer (find-buffer-visiting temp-ics)
1412 (set-buffer-modified-p nil)
1413 (kill-buffer (current-buffer)))
1414 (delete-file temp-diary)
1415 (delete-file temp-ics))))
1416
1417 (ert-deftest icalendar-cycle ()
1418 "Perform cycling tests.
1419 Take care to avoid auto-generated UIDs here."
1420 (icalendar-tests--test-cycle
1421 "UID:dummyuid
1422 DTSTART;VALUE=DATE-TIME:20030919T090000
1423 DTEND;VALUE=DATE-TIME:20030919T113000
1424 SUMMARY:Cycletest
1425 ")
1426 (icalendar-tests--test-cycle
1427 "UID:blah
1428 DTSTART;VALUE=DATE-TIME:20030919T090000
1429 DTEND;VALUE=DATE-TIME:20030919T113000
1430 SUMMARY:Cycletest
1431 DESCRIPTION:beschreibung!
1432 LOCATION:nowhere
1433 ORGANIZER:ulf
1434 ")
1435 (icalendar-tests--test-cycle
1436 "UID:4711
1437 DTSTART;VALUE=DATE:19190909
1438 DTEND;VALUE=DATE:19190910
1439 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1440 SUMMARY:and diary-anniversary
1441 "))
1442
1443 ;; ======================================================================
1444 ;; Real world
1445 ;; ======================================================================
1446 (ert-deftest icalendar-real-world ()
1447 "Perform real-world tests, as gathered from problem reports."
1448 ;; This is known to fail on MS-Windows, since it doesn't support DST
1449 ;; specification with month and day.
1450 :expected-result (if (memq system-type '(windows-nt ms-dos))
1451 :failed
1452 :passed)
1453 ;; 2003-05-29
1454 (icalendar-tests--test-import
1455 "BEGIN:VCALENDAR
1456 METHOD:REQUEST
1457 PRODID:Microsoft CDO for Microsoft Exchange
1458 VERSION:2.0
1459 BEGIN:VTIMEZONE
1460 TZID:Kolkata, Chennai, Mumbai, New Delhi
1461 X-MICROSOFT-CDO-TZID:23
1462 BEGIN:STANDARD
1463 DTSTART:16010101T000000
1464 TZOFFSETFROM:+0530
1465 TZOFFSETTO:+0530
1466 END:STANDARD
1467 BEGIN:DAYLIGHT
1468 DTSTART:16010101T000000
1469 TZOFFSETFROM:+0530
1470 TZOFFSETTO:+0530
1471 END:DAYLIGHT
1472 END:VTIMEZONE
1473 BEGIN:VEVENT
1474 DTSTAMP:20030509T043439Z
1475 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
1476 SUMMARY:On-Site Interview
1477 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
1478 010000000DB823520692542408ED02D7023F9DFF9
1479 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
1480 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
1481 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
1482 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
1483 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
1484 zz\":MAILTO:zzzzzz@zzzzzzz.com
1485 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
1486 LOCATION:Cccc
1487 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
1488 DESCRIPTION:10:30am - Blah
1489 SEQUENCE:0
1490 PRIORITY:5
1491 CLASS:
1492 CREATED:20030509T043439Z
1493 LAST-MODIFIED:20030509T043459Z
1494 STATUS:CONFIRMED
1495 TRANSP:OPAQUE
1496 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1497 X-MICROSOFT-CDO-INSTTYPE:0
1498 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1499 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1500 X-MICROSOFT-CDO-IMPORTANCE:1
1501 X-MICROSOFT-CDO-OWNERAPPTID:126441427
1502 BEGIN:VALARM
1503 ACTION:DISPLAY
1504 DESCRIPTION:REMINDER
1505 TRIGGER;RELATED=START:-PT00H15M00S
1506 END:VALARM
1507 END:VEVENT
1508 END:VCALENDAR"
1509 nil
1510 "&9/5/2003 07:00-12:00 On-Site Interview
1511 Desc: 10:30am - Blah
1512 Location: Cccc
1513 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1514 Status: CONFIRMED
1515 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1516 "
1517 "&5/9/2003 07:00-12:00 On-Site Interview
1518 Desc: 10:30am - Blah
1519 Location: Cccc
1520 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1521 Status: CONFIRMED
1522 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1523 ")
1524
1525 ;; created with http://apps.marudot.com/ical/
1526 (icalendar-tests--test-import
1527 "BEGIN:VCALENDAR
1528 VERSION:2.0
1529 PRODID:-//www.marudot.com//iCal Event Maker
1530 X-WR-CALNAME:Test
1531 CALSCALE:GREGORIAN
1532 BEGIN:VTIMEZONE
1533 TZID:Asia/Tehran
1534 TZURL:http://tzurl.org/zoneinfo-outlook/Asia/Tehran
1535 X-LIC-LOCATION:Asia/Tehran
1536 BEGIN:STANDARD
1537 TZOFFSETFROM:+0330
1538 TZOFFSETTO:+0330
1539 TZNAME:IRST
1540 DTSTART:19700101T000000
1541 END:STANDARD
1542 END:VTIMEZONE
1543 BEGIN:VEVENT
1544 DTSTAMP:20141116T171439Z
1545 UID:20141116T171439Z-678877132@marudot.com
1546 DTSTART;TZID=\"Asia/Tehran\":20141116T070000
1547 DTEND;TZID=\"Asia/Tehran\":20141116T080000
1548 SUMMARY:NoDST
1549 DESCRIPTION:Test event from timezone without DST
1550 LOCATION:Everywhere
1551 END:VEVENT
1552 END:VCALENDAR"
1553 nil
1554 "&16/11/2014 04:30-05:30 NoDST
1555 Desc: Test event from timezone without DST
1556 Location: Everywhere
1557 UID: 20141116T171439Z-678877132@marudot.com
1558 "
1559 "&11/16/2014 04:30-05:30 NoDST
1560 Desc: Test event from timezone without DST
1561 Location: Everywhere
1562 UID: 20141116T171439Z-678877132@marudot.com
1563 ")
1564
1565
1566 ;; 2003-06-18 a
1567 (icalendar-tests--test-import
1568 "DTSTAMP:20030618T195512Z
1569 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
1570 SUMMARY:Dress Rehearsal for XXXX-XXXX
1571 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1572 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1573 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
1574 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
1575 ORGANIZER;CN=\"ABCD,TECHTRAINING
1576 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
1577 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
1578 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
1579 DESCRIPTION:753 Zeichen hier radiert
1580 SEQUENCE:0
1581 PRIORITY:5
1582 CLASS:
1583 CREATED:20030618T195518Z
1584 LAST-MODIFIED:20030618T195527Z
1585 STATUS:CONFIRMED
1586 TRANSP:OPAQUE
1587 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1588 X-MICROSOFT-CDO-INSTTYPE:0
1589 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1590 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1591 X-MICROSOFT-CDO-IMPORTANCE:1
1592 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1593 BEGIN:VALARM
1594 ACTION:DISPLAY
1595 DESCRIPTION:REMINDER
1596 TRIGGER;RELATED=START:-PT00H15M00S
1597 END:VALARM"
1598 nil
1599 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1600 Desc: 753 Zeichen hier radiert
1601 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1602 Organizer: MAILTO:xxx@xxxxx.com
1603 Status: CONFIRMED
1604 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1605 "
1606 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1607 Desc: 753 Zeichen hier radiert
1608 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1609 Organizer: MAILTO:xxx@xxxxx.com
1610 Status: CONFIRMED
1611 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1612 ")
1613 ;; 2003-06-18 b -- uses timezone
1614 (icalendar-tests--test-import
1615 "BEGIN:VCALENDAR
1616 METHOD:REQUEST
1617 PRODID:Microsoft CDO for Microsoft Exchange
1618 VERSION:2.0
1619 BEGIN:VTIMEZONE
1620 TZID:Mountain Time (US & Canada)
1621 X-MICROSOFT-CDO-TZID:12
1622 BEGIN:STANDARD
1623 DTSTART:16010101T020000
1624 TZOFFSETFROM:-0600
1625 TZOFFSETTO:-0700
1626 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
1627 END:STANDARD
1628 BEGIN:DAYLIGHT
1629 DTSTART:16010101T020000
1630 TZOFFSETFROM:-0700
1631 TZOFFSETTO:-0600
1632 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
1633 END:DAYLIGHT
1634 END:VTIMEZONE
1635 BEGIN:VEVENT
1636 DTSTAMP:20030618T230323Z
1637 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
1638 SUMMARY:Updated: Dress Rehearsal for ABC01-15
1639 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1640 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1641 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
1642 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
1643 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
1644 .com
1645 ORGANIZER;CN=\"ABCD,TECHTRAINING
1646 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
1647 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
1648 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
1649 DESCRIPTION:Viele Zeichen standen hier früher
1650 SEQUENCE:0
1651 PRIORITY:5
1652 CLASS:
1653 CREATED:20030618T230326Z
1654 LAST-MODIFIED:20030618T230335Z
1655 STATUS:CONFIRMED
1656 TRANSP:OPAQUE
1657 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1658 X-MICROSOFT-CDO-INSTTYPE:0
1659 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1660 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1661 X-MICROSOFT-CDO-IMPORTANCE:1
1662 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1663 BEGIN:VALARM
1664 ACTION:DISPLAY
1665 DESCRIPTION:REMINDER
1666 TRIGGER;RELATED=START:-PT00H15M00S
1667 END:VALARM
1668 END:VEVENT
1669 END:VCALENDAR"
1670 nil
1671 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1672 Desc: Viele Zeichen standen hier früher
1673 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1674 Organizer: MAILTO:bbb@bbbbb.com
1675 Status: CONFIRMED
1676 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1677 "
1678 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1679 Desc: Viele Zeichen standen hier früher
1680 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1681 Organizer: MAILTO:bbb@bbbbb.com
1682 Status: CONFIRMED
1683 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1684 ")
1685 ;; export 2004-10-28 block entries
1686 (icalendar-tests--test-export
1687 nil
1688 nil
1689 "-*- mode: text; fill-column: 256;-*-
1690
1691 >>> block entries:
1692
1693 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1694 "
1695 "DTSTART;VALUE=DATE:20041108
1696 DTEND;VALUE=DATE:20041111
1697 SUMMARY:Nov 8-10 aa")
1698
1699 (icalendar-tests--test-export
1700 nil
1701 nil
1702 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1703 "DTSTART;VALUE=DATE:20041213
1704 DTEND;VALUE=DATE:20041218
1705 SUMMARY:Dec 13-17 bb")
1706
1707 (icalendar-tests--test-export
1708 nil
1709 nil
1710 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1711 "DTSTART;VALUE=DATE:20050203
1712 DTEND;VALUE=DATE:20050205
1713 SUMMARY:Feb 3-4 cc")
1714
1715 (icalendar-tests--test-export
1716 nil
1717 nil
1718 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1719 "DTSTART;VALUE=DATE:20050424
1720 DTEND;VALUE=DATE:20050430
1721 SUMMARY:April 24-29 dd
1722 ")
1723 (icalendar-tests--test-export
1724 nil
1725 nil
1726 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1727 "DTSTART;VALUE=DATE:20050530
1728 DTEND;VALUE=DATE:20050602
1729 SUMMARY:may 30 - June 1: ee")
1730
1731 (icalendar-tests--test-export
1732 nil
1733 nil
1734 "%%(diary-block 6 6 2005 6 8 2005) ff"
1735 "DTSTART;VALUE=DATE:20050606
1736 DTEND;VALUE=DATE:20050609
1737 SUMMARY:ff")
1738
1739 ;; export 2004-10-28 anniversary entries
1740 (icalendar-tests--test-export
1741 nil
1742 nil
1743 "
1744 >>> anniversaries:
1745
1746 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1747 "DTSTART;VALUE=DATE:19910328
1748 DTEND;VALUE=DATE:19910329
1749 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1750 SUMMARY:aa birthday (%d years old)
1751 ")
1752
1753 (icalendar-tests--test-export
1754 nil
1755 nil
1756 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1757 "DTSTART;VALUE=DATE:19570517
1758 DTEND;VALUE=DATE:19570518
1759 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1760 SUMMARY:bb birthday (%d years old)")
1761
1762 (icalendar-tests--test-export
1763 nil
1764 nil
1765 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1766 "DTSTART;VALUE=DATE:19970608
1767 DTEND;VALUE=DATE:19970609
1768 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1769 SUMMARY:cc birthday (%d years old)")
1770
1771 (icalendar-tests--test-export
1772 nil
1773 nil
1774 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1775 "DTSTART;VALUE=DATE:19830722
1776 DTEND;VALUE=DATE:19830723
1777 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1778 SUMMARY:dd (%d years ago...!)")
1779
1780 (icalendar-tests--test-export
1781 nil
1782 nil
1783 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1784 "DTSTART;VALUE=DATE:19880801
1785 DTEND;VALUE=DATE:19880802
1786 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1787 SUMMARY:ee birthday (%d years old)")
1788
1789 (icalendar-tests--test-export
1790 nil
1791 nil
1792 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1793 "DTSTART;VALUE=DATE:19570921
1794 DTEND;VALUE=DATE:19570922
1795 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1796 SUMMARY:ff birthday (%d years old)")
1797
1798
1799 ;; FIXME!
1800
1801 ;; export 2004-10-28 monthly, weekly entries
1802
1803 ;; (icalendar-tests--test-export
1804 ;; nil
1805 ;; "
1806 ;; >>> ------------ monthly:
1807
1808 ;; */27/* 10:00 blah blah"
1809 ;; "xxx")
1810
1811 (icalendar-tests--test-export
1812 nil
1813 nil
1814 ">>> ------------ my week:
1815
1816 Monday 13:00 MAC"
1817 "DTSTART;VALUE=DATE-TIME:20000103T130000
1818 DTEND;VALUE=DATE-TIME:20000103T140000
1819 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1820 SUMMARY:MAC")
1821
1822 (icalendar-tests--test-export
1823 nil
1824 nil
1825 "Monday 15:00 a1"
1826 "DTSTART;VALUE=DATE-TIME:20000103T150000
1827 DTEND;VALUE=DATE-TIME:20000103T160000
1828 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1829 SUMMARY:a1")
1830
1831
1832 (icalendar-tests--test-export
1833 nil
1834 nil
1835 "Monday 16:00-17:00 a2"
1836 "DTSTART;VALUE=DATE-TIME:20000103T160000
1837 DTEND;VALUE=DATE-TIME:20000103T170000
1838 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1839 SUMMARY:a2")
1840
1841 (icalendar-tests--test-export
1842 nil
1843 nil
1844 "Tuesday 11:30-13:00 a3"
1845 "DTSTART;VALUE=DATE-TIME:20000104T113000
1846 DTEND;VALUE=DATE-TIME:20000104T130000
1847 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1848 SUMMARY:a3")
1849
1850 (icalendar-tests--test-export
1851 nil
1852 nil
1853 "Tuesday 15:00 a4"
1854 "DTSTART;VALUE=DATE-TIME:20000104T150000
1855 DTEND;VALUE=DATE-TIME:20000104T160000
1856 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1857 SUMMARY:a4")
1858
1859 (icalendar-tests--test-export
1860 nil
1861 nil
1862 "Wednesday 13:00 a5"
1863 "DTSTART;VALUE=DATE-TIME:20000105T130000
1864 DTEND;VALUE=DATE-TIME:20000105T140000
1865 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1866 SUMMARY:a5")
1867
1868 (icalendar-tests--test-export
1869 nil
1870 nil
1871 "Wednesday 11:30-13:30 a6"
1872 "DTSTART;VALUE=DATE-TIME:20000105T113000
1873 DTEND;VALUE=DATE-TIME:20000105T133000
1874 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1875 SUMMARY:a6")
1876
1877 (icalendar-tests--test-export
1878 nil
1879 nil
1880 "Wednesday 15:00 s1"
1881 "DTSTART;VALUE=DATE-TIME:20000105T150000
1882 DTEND;VALUE=DATE-TIME:20000105T160000
1883 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1884 SUMMARY:s1")
1885
1886
1887 ;; export 2004-10-28 regular entries
1888 (icalendar-tests--test-export
1889 nil
1890 nil
1891 "
1892 >>> regular diary entries:
1893
1894 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1895 "DTSTART;VALUE=DATE-TIME:20041012T140000
1896 DTEND;VALUE=DATE-TIME:20041012T150000
1897 SUMMARY:Tue: [2004-10-12] q1")
1898
1899 ;; 2004-11-19
1900 (icalendar-tests--test-import
1901 "BEGIN:VCALENDAR
1902 VERSION
1903 :2.0
1904 PRODID
1905 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1906 BEGIN:VEVENT
1907 SUMMARY
1908 :Jjjjj & Wwwww
1909 STATUS
1910 :TENTATIVE
1911 CLASS
1912 :PRIVATE
1913 X-MOZILLA-ALARM-DEFAULT-LENGTH
1914 :0
1915 DTSTART
1916 :20041123T140000
1917 DTEND
1918 :20041123T143000
1919 DTSTAMP
1920 :20041118T013430Z
1921 LAST-MODIFIED
1922 :20041118T013640Z
1923 END:VEVENT
1924 BEGIN:VEVENT
1925 SUMMARY
1926 :BB Aaaaaaaa Bbbbb
1927 STATUS
1928 :TENTATIVE
1929 CLASS
1930 :PRIVATE
1931 X-MOZILLA-ALARM-DEFAULT-LENGTH
1932 :0
1933 DTSTART
1934 :20041123T144500
1935 DTEND
1936 :20041123T154500
1937 DTSTAMP
1938 :20041118T013641Z
1939 END:VEVENT
1940 BEGIN:VEVENT
1941 SUMMARY
1942 :Hhhhhhhh
1943 STATUS
1944 :TENTATIVE
1945 CLASS
1946 :PRIVATE
1947 X-MOZILLA-ALARM-DEFAULT-LENGTH
1948 :0
1949 DTSTART
1950 :20041123T110000
1951 DTEND
1952 :20041123T120000
1953 DTSTAMP
1954 :20041118T013831Z
1955 END:VEVENT
1956 BEGIN:VEVENT
1957 SUMMARY
1958 :MMM Aaaaaaaaa
1959 STATUS
1960 :TENTATIVE
1961 CLASS
1962 :PRIVATE
1963 X-MOZILLA-ALARM-DEFAULT-LENGTH
1964 :0
1965 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1966 :2
1967 RRULE
1968 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1969 DTSTART
1970 :20041112T140000
1971 DTEND
1972 :20041112T183000
1973 DTSTAMP
1974 :20041118T014117Z
1975 END:VEVENT
1976 BEGIN:VEVENT
1977 SUMMARY
1978 :Rrrr/Cccccc ii Aaaaaaaa
1979 DESCRIPTION
1980 :Vvvvv Rrrr aaa Cccccc
1981 STATUS
1982 :TENTATIVE
1983 CLASS
1984 :PRIVATE
1985 X-MOZILLA-ALARM-DEFAULT-LENGTH
1986 :0
1987 DTSTART
1988 ;VALUE=DATE
1989 :20041119
1990 DTEND
1991 ;VALUE=DATE
1992 :20041120
1993 DTSTAMP
1994 :20041118T013107Z
1995 LAST-MODIFIED
1996 :20041118T014203Z
1997 END:VEVENT
1998 BEGIN:VEVENT
1999 SUMMARY
2000 :Wwww aa hhhh
2001 STATUS
2002 :TENTATIVE
2003 CLASS
2004 :PRIVATE
2005 X-MOZILLA-ALARM-DEFAULT-LENGTH
2006 :0
2007 RRULE
2008 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
2009 DTSTART
2010 ;VALUE=DATE
2011 :20041101
2012 DTEND
2013 ;VALUE=DATE
2014 :20041102
2015 DTSTAMP
2016 :20041118T014045Z
2017 LAST-MODIFIED
2018 :20041118T023846Z
2019 END:VEVENT
2020 END:VCALENDAR
2021 "
2022 nil
2023 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
2024 Status: TENTATIVE
2025 Class: PRIVATE
2026 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2027 Status: TENTATIVE
2028 Class: PRIVATE
2029 &23/11/2004 11:00-12:00 Hhhhhhhh
2030 Status: TENTATIVE
2031 Class: PRIVATE
2032 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
2033 Status: TENTATIVE
2034 Class: PRIVATE
2035 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
2036 Desc: Vvvvv Rrrr aaa Cccccc
2037 Status: TENTATIVE
2038 Class: PRIVATE
2039 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
2040 Status: TENTATIVE
2041 Class: PRIVATE
2042 "
2043 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
2044 Status: TENTATIVE
2045 Class: PRIVATE
2046 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
2047 Status: TENTATIVE
2048 Class: PRIVATE
2049 &11/23/2004 11:00-12:00 Hhhhhhhh
2050 Status: TENTATIVE
2051 Class: PRIVATE
2052 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
2053 Status: TENTATIVE
2054 Class: PRIVATE
2055 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
2056 Desc: Vvvvv Rrrr aaa Cccccc
2057 Status: TENTATIVE
2058 Class: PRIVATE
2059 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
2060 Status: TENTATIVE
2061 Class: PRIVATE
2062 ")
2063
2064 ;; 2004-09-09 pg
2065 (icalendar-tests--test-export
2066 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
2067 nil
2068 nil
2069 "DTSTART;VALUE=DATE:20040101
2070 DTEND;VALUE=DATE:20040105
2071 SUMMARY:Urlaub")
2072
2073 ;; 2004-10-25 pg
2074 (icalendar-tests--test-export
2075 nil
2076 "5 11 2004 Bla Fasel"
2077 nil
2078 "DTSTART;VALUE=DATE:20041105
2079 DTEND;VALUE=DATE:20041106
2080 SUMMARY:Bla Fasel")
2081
2082 ;; 2004-10-30 pg
2083 (icalendar-tests--test-export
2084 nil
2085 "2 Nov 2004 15:00-16:30 Zahnarzt"
2086 nil
2087 "DTSTART;VALUE=DATE-TIME:20041102T150000
2088 DTEND;VALUE=DATE-TIME:20041102T163000
2089 SUMMARY:Zahnarzt")
2090
2091 ;; 2005-02-07 lt
2092 (icalendar-tests--test-import
2093 "UID
2094 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
2095 SUMMARY
2096 :Waitangi Day
2097 DESCRIPTION
2098 :abcdef
2099 CATEGORIES
2100 :Public Holiday
2101 STATUS
2102 :CONFIRMED
2103 CLASS
2104 :PRIVATE
2105 DTSTART
2106 ;VALUE=DATE
2107 :20050206
2108 DTEND
2109 ;VALUE=DATE
2110 :20050207
2111 DTSTAMP
2112 :20050128T011209Z"
2113 nil
2114 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
2115 Desc: abcdef
2116 Status: CONFIRMED
2117 Class: PRIVATE
2118 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2119 "
2120 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
2121 Desc: abcdef
2122 Status: CONFIRMED
2123 Class: PRIVATE
2124 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
2125 ")
2126
2127 ;; 2005-03-01 lt
2128 (icalendar-tests--test-import
2129 "DTSTART;VALUE=DATE:20050217
2130 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
2131 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
2132 DTSTAMP:20050118T210335Z
2133 DURATION:P7D"
2134 nil
2135 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2136 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
2137 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
2138 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
2139
2140 ;; 2005-03-23 lt
2141 (icalendar-tests--test-export
2142 nil
2143 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
2144 nil
2145 "DTSTART;VALUE=DATE-TIME:20050208T160000
2146 DTEND;VALUE=DATE-TIME:20050208T164500
2147 RRULE:FREQ=DAILY;INTERVAL=7
2148 SUMMARY:[WORK] Pppp
2149 ")
2150
2151 ;; 2005-05-27 eu
2152 (icalendar-tests--test-export
2153 nil
2154 nil
2155 ;; FIXME: colon not allowed!
2156 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2157 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
2158 "DTSTART;VALUE=DATE:19001101
2159 DTEND;VALUE=DATE:19001102
2160 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
2161 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
2162 ")
2163
2164 ;; bug#11473
2165 (icalendar-tests--test-import
2166 "BEGIN:VCALENDAR
2167 METHOD:REQUEST
2168 PRODID:Microsoft Exchange Server 2007
2169 VERSION:2.0
2170 BEGIN:VTIMEZONE
2171 TZID:(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
2172 BEGIN:STANDARD
2173 DTSTART:16010101T030000
2174 TZOFFSETFROM:+0200
2175 TZOFFSETTO:+0100
2176 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
2177 END:STANDARD
2178 BEGIN:DAYLIGHT
2179 DTSTART:16010101T020000
2180 TZOFFSETFROM:+0100
2181 TZOFFSETTO:+0200
2182 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
2183 END:DAYLIGHT
2184 END:VTIMEZONE
2185 BEGIN:VEVENT
2186 ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com
2187 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth
2188 er\":MAILTO:other.luser@foo.com
2189 DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n
2190 SUMMARY;LANGUAGE=en-US:Query
2191 DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\"
2192 :20120515T150000
2193 DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2
2194 0120515T153000
2195 UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000
2196 010000000575268034ECDB649A15349B1BF240F15
2197 RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V
2198 ienna\":20120515T170000
2199 CLASS:PUBLIC
2200 PRIORITY:5
2201 DTSTAMP:20120514T153645Z
2202 TRANSP:OPAQUE
2203 STATUS:CONFIRMED
2204 SEQUENCE:15
2205 LOCATION;LANGUAGE=en-US:phone
2206 X-MICROSOFT-CDO-APPT-SEQUENCE:15
2207 X-MICROSOFT-CDO-OWNERAPPTID:1907632092
2208 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
2209 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
2210 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
2211 X-MICROSOFT-CDO-IMPORTANCE:1
2212 X-MICROSOFT-CDO-INSTTYPE:3
2213 BEGIN:VALARM
2214 ACTION:DISPLAY
2215 DESCRIPTION:REMINDER
2216 TRIGGER;RELATED=START:-PT15M
2217 END:VALARM
2218 END:VEVENT
2219 END:VCALENDAR"
2220 nil
2221 "&15/5/2012 15:00-15:30 Query
2222 Location: phone
2223 Organizer: MAILTO:a.luser@foo.com
2224 Status: CONFIRMED
2225 Class: PUBLIC
2226 UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15
2227 " nil)
2228
2229 ;; 2015-12-05, mixed line endings and empty lines, see Bug#22092.
2230 (icalendar-tests--test-import
2231 "BEGIN:VCALENDAR\r
2232 PRODID:-//www.norwegian.no//iCalendar MIMEDIR//EN\r
2233 VERSION:2.0\r
2234 METHOD:REQUEST\r
2235 BEGIN:VEVENT\r
2236 UID:RFCALITEM1\r
2237 SEQUENCE:1512040950\r
2238 DTSTAMP:20141204T095043Z\r
2239 ORGANIZER:noreply@norwegian.no\r
2240 DTSTART:20141208T173000Z\r
2241
2242 DTEND:20141208T215500Z\r
2243
2244 LOCATION:Stavanger-Sola\r
2245
2246 DESCRIPTION:Fly med Norwegian, reservasjon. Fra Stavanger til Troms&#248; 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Troms&#248; 8. des 2014 21:00, DY390\r
2247
2248 X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"><html><head><META NAME=\"Generator\" CONTENT=\"MS Exchange Server version 08.00.0681.000\"><title></title></head><body><b><font face=\"Calibri\" size=\"3\">Reisereferanse</p></body></html>
2249 SUMMARY:Norwegian til Tromsoe-Langnes -\r
2250
2251 CATEGORIES:Appointment\r
2252
2253
2254 PRIORITY:5\r
2255
2256 CLASS:PUBLIC\r
2257
2258 TRANSP:OPAQUE\r
2259 END:VEVENT\r
2260 END:VCALENDAR
2261 "
2262 "&2014/12/8 18:30-22:55 Norwegian til Tromsoe-Langnes -
2263 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Troms&#248; 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Troms&#248; 8. des 2014 21:00, DY390
2264 Location: Stavanger-Sola
2265 Organizer: noreply@norwegian.no
2266 Class: PUBLIC
2267 UID: RFCALITEM1
2268 "
2269 "&8/12/2014 18:30-22:55 Norwegian til Tromsoe-Langnes -
2270 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Troms&#248; 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Troms&#248; 8. des 2014 21:00, DY390
2271 Location: Stavanger-Sola
2272 Organizer: noreply@norwegian.no
2273 Class: PUBLIC
2274 UID: RFCALITEM1
2275 "
2276 "&12/8/2014 18:30-22:55 Norwegian til Tromsoe-Langnes -
2277 Desc: Fly med Norwegian, reservasjon. Fra Stavanger til Troms&#248; 8. des 2014 18:30, DY545Fly med Norwegian, reservasjon . Fra Stavanger til Troms&#248; 8. des 2014 21:00, DY390
2278 Location: Stavanger-Sola
2279 Organizer: noreply@norwegian.no
2280 Class: PUBLIC
2281 UID: RFCALITEM1
2282 "
2283 )
2284 )
2285
2286 (provide 'icalendar-tests)
2287 ;;; icalendar-tests.el ends here