* keyboard.c (parse_modifiers_uncached, parse_modifiers):
[emacs.git] / test / automated / icalendar-tests.el
blobd586230f6424126aea3fe5b6c9a3cb63a558a973
1 ;; icalendar-tests.el --- Test suite for icalendar.el
3 ;; Copyright (C) 2005, 2008-2011 Free Software Foundation, Inc.
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
6 ;; Created: March 2005
7 ;; Keywords: calendar
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/>.
25 ;;; Commentary:
27 ;; TODO:
28 ;; - Add more unit tests for functions, timezone etc.
30 ;; Note: Watch the trailing blank that is added on import.
32 ;;; Code:
34 (require 'ert)
35 (require 'icalendar)
37 ;; ======================================================================
38 ;; Helpers
39 ;; ======================================================================
41 (defun icalendar-tests--get-ical-event (ical-string)
42 "Return icalendar event for ICAL-STRING."
43 (save-excursion
44 (with-temp-buffer
45 (insert 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 (defun icalendar-tests--compare-strings (str1 str2)
55 "Compare strings STR1 and STR2.
56 Return t if strings are equal, else return substring indicating first difference.
57 FIXME: make this a little smarter."
58 (let* ((s1 (icalendar-tests--trim str1))
59 (s2 (icalendar-tests--trim str2))
60 (result (compare-strings s1 0 nil s2 0 nil))
61 (len (length str2)))
62 (if (numberp result)
63 (if (> result 0)
64 (concat "..." (substring str2 (- result 1)
65 (min len (+ (- result 1) 3))) "...")
66 (concat "..." (substring str2 (- (+ result 1))
67 (min len (+ (- (+ result 1)) 3))) "..."))
68 t)))
70 (ert-deftest icalendar-tests--compare-strings ()
71 "Test icalendar-tests--compare-strings."
72 (should (equal t (icalendar-tests--compare-strings " abcde" "abcde ")))
73 (should
74 (string= "...def..."
75 (icalendar-tests--compare-strings "abcxe" "abcdefghijklmn")))
76 (should (string= "...xe..."
77 (icalendar-tests--compare-strings "abcde" "abcxe")))
78 (should (string= "...ddd..."
79 (icalendar-tests--compare-strings "abc" "abcdddddd")))
80 (should (string= "......"
81 (icalendar-tests--compare-strings "abcdefghij" "abc"))))
83 ;; ======================================================================
84 ;; Tests of functions
85 ;; ======================================================================
87 (ert-deftest icalendar--create-uid ()
88 "Test for `icalendar--create-uid'."
89 (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s")
90 t-ct
91 (icalendar--uid-count 77)
92 (entry-full "30.06.1964 07:01 blahblah")
93 (hash (format "%d" (abs (sxhash entry-full))))
94 (contents "DTSTART:19640630T070100\nblahblah")
95 (username (or user-login-name "UNKNOWN_USER"))
97 (fset 't-ct (symbol-function 'current-time))
98 (unwind-protect
99 (progn
100 (fset 'current-time (lambda () '(1 2 3)))
101 (should (= 77 icalendar--uid-count))
102 (should (string= (concat "xxx-123-77-" hash "-" username "-19640630")
103 (icalendar--create-uid entry-full contents)))
104 (should (= 78 icalendar--uid-count)))
105 ;; restore 'current-time
106 (fset 'current-time (symbol-function 't-ct)))
107 (setq contents "blahblah")
108 (setq icalendar-uid-format "yyy%syyy")
109 (should (string= (concat "yyyDTSTARTyyy")
110 (icalendar--create-uid entry-full contents)))))
112 (ert-deftest icalendar--calendar-style ()
113 "Test for `icalendar--date-style'."
114 (dolist (calendar-date-style '(iso american european))
115 (should (eq (icalendar--date-style) calendar-date-style)))
116 (let ((cds calendar-date-style)
117 (european-calendar-style t))
118 (makunbound 'calendar-date-style)
119 (should (eq (icalendar--date-style) 'european))
120 (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME
121 (should (eq (icalendar--date-style) 'american))
122 (setq calendar-date-style cds)))
124 (ert-deftest icalendar-convert-anniversary-to-ical ()
125 "Test method for `icalendar--convert-anniversary-to-ical'."
126 (let* ((calendar-date-style 'iso)
127 result)
128 (setq result (icalendar--convert-anniversary-to-ical
129 "" "%%(diary-anniversary 1964 6 30) g"))
130 (should (= 2 (length result)))
131 (should (string= (concat
132 "\nDTSTART;VALUE=DATE:19640630"
133 "\nDTEND;VALUE=DATE:19640701"
134 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
135 (car result)))
136 (should (string= "g" (cadr result)))))
138 (ert-deftest icalendar--convert-cyclic-to-ical ()
139 "Test method for `icalendar--convert-cyclic-to-ical'."
140 (let* ((calendar-date-style 'iso)
141 result)
142 (setq result (icalendar--convert-block-to-ical
143 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
144 (should (= 2 (length result)))
145 (should (string= (concat
146 "\nDTSTART;VALUE=DATE:20040719"
147 "\nDTEND;VALUE=DATE:20040828")
148 (car result)))
149 (should (string= "Sommerferien" (cadr result)))))
151 (ert-deftest icalendar--convert-block-to-ical ()
152 "Test method for `icalendar--convert-block-to-ical'."
153 (let* ((calendar-date-style 'iso)
154 result)
155 (setq result (icalendar--convert-block-to-ical
156 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
157 (should (= 2 (length result)))
158 (should (string= (concat
159 "\nDTSTART;VALUE=DATE:20040719"
160 "\nDTEND;VALUE=DATE:20040828")
161 (car result)))
162 (should (string= "Sommerferien" (cadr result)))))
164 (ert-deftest icalendar--convert-yearly-to-ical ()
165 "Test method for `icalendar--convert-yearly-to-ical'."
166 (let* ((calendar-date-style 'iso)
167 result
168 (calendar-month-name-array
169 ["January" "February" "March" "April" "May" "June" "July" "August"
170 "September" "October" "November" "December"]))
171 (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
172 (should (= 2 (length result)))
173 (should (string= (concat
174 "\nDTSTART;VALUE=DATE:19000501"
175 "\nDTEND;VALUE=DATE:19000502"
176 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
177 (car result)))
178 (should (string= "Tag der Arbeit" (cadr result)))))
180 (ert-deftest icalendar--convert-weekly-to-ical ()
181 "Test method for `icalendar--convert-weekly-to-ical'."
182 (let* ((calendar-date-style 'iso)
183 result
184 (calendar-day-name-array
185 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
186 "Saturday"]))
187 (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
188 (should (= 2 (length result)))
189 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
190 "\nDTEND;VALUE=DATE-TIME:20050103T093000"
191 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
192 (car result)))
193 (should (string= "subject" (cadr result)))))
195 (ert-deftest icalendar--parse-vtimezone ()
196 "Test method for `icalendar--parse-vtimezone'."
197 (let (vtimezone result)
198 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
199 TZID:thename
200 BEGIN:STANDARD
201 DTSTART:16010101T040000
202 TZOFFSETFROM:+0300
203 TZOFFSETTO:+0200
204 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
205 END:STANDARD
206 BEGIN:DAYLIGHT
207 DTSTART:16010101T030000
208 TZOFFSETFROM:+0200
209 TZOFFSETTO:+0300
210 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
211 END:DAYLIGHT
212 END:VTIMEZONE
214 (setq result (icalendar--parse-vtimezone vtimezone))
215 (should (string= "thename" (car result)))
216 (message (cdr result))
217 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
218 (cdr result)))
219 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
220 TZID:anothername
221 BEGIN:STANDARD
222 DTSTART:16010101T040000
223 TZOFFSETFROM:+0300
224 TZOFFSETTO:+0200
225 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
226 END:STANDARD
227 BEGIN:DAYLIGHT
228 DTSTART:16010101T030000
229 TZOFFSETFROM:+0200
230 TZOFFSETTO:+0300
231 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
232 END:DAYLIGHT
233 END:VTIMEZONE
235 (setq result (icalendar--parse-vtimezone vtimezone))
236 (should (string= "anothername" (car result)))
237 (message (cdr result))
238 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
239 (cdr result)))))
241 (ert-deftest icalendar--convert-ordinary-to-ical ()
242 "Test method for `icalendar--convert-ordinary-to-ical'."
243 (let* ((calendar-date-style 'iso)
244 result)
245 ;; without time
246 (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
247 (should (= 2 (length result)))
248 (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
249 (car result)))
250 (should (string= "subject" (cadr result)))
252 ;; with time
253 (setq result (icalendar--convert-ordinary-to-ical
254 "&?" "&2010 2 15 12:34-23:45 s"))
255 (should (= 2 (length result)))
256 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
257 "\nDTEND;VALUE=DATE-TIME:20100215T234500")
258 (car result)))
259 (should (string= "s" (cadr result)))
261 ;; with time, again -- test bug#5549
262 (setq result (icalendar--convert-ordinary-to-ical
263 "x?" "x2010 2 15 0:34-1:45 s"))
264 (should (= 2 (length result)))
265 (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
266 "\nDTEND;VALUE=DATE-TIME:20100215T014500")
267 (car result)))
268 (should (string= "s" (cadr result)))))
270 (ert-deftest icalendar--diarytime-to-isotime ()
271 "Test method for `icalendar--diarytime-to-isotime'."
272 (should (string= (icalendar--diarytime-to-isotime "01:15" "")
273 "T011500"))
274 (should (string= (icalendar--diarytime-to-isotime "1:15" "")
275 "T011500"))
276 (should (string= (icalendar--diarytime-to-isotime "0:01" "")
277 "T000100"))
278 (should (string= (icalendar--diarytime-to-isotime "0100" "")
279 "T010000"))
280 (should (string= (icalendar--diarytime-to-isotime "0100" "am")
281 "T010000"))
282 (should (string= (icalendar--diarytime-to-isotime "0100" "pm")
283 "T130000"))
284 (should (string= (icalendar--diarytime-to-isotime "1200" "")
285 "T120000"))
286 (should (string= (icalendar--diarytime-to-isotime "17:17" "")
287 "T171700"))
288 (should (string= (icalendar--diarytime-to-isotime "1200" "am")
289 "T000000"))
290 (should (string= (icalendar--diarytime-to-isotime "1201" "am")
291 "T000100"))
292 (should (string= (icalendar--diarytime-to-isotime "1259" "am")
293 "T005900"))
294 (should (string= (icalendar--diarytime-to-isotime "1200" "pm")
295 "T120000"))
296 (should (string= (icalendar--diarytime-to-isotime "1201" "pm")
297 "T120100"))
298 (should (string= (icalendar--diarytime-to-isotime "1259" "pm")
299 "T125900")))
301 (ert-deftest icalendar--datetime-to-diary-date ()
302 "Test method for `icalendar--datetime-to-diary-date'."
303 (let* ((datetime '(59 59 23 31 12 2008))
304 (calendar-date-style 'iso))
305 (should (string= (icalendar--datetime-to-diary-date datetime)
306 "2008 12 31"))
307 (setq calendar-date-style 'european)
308 (should (string= (icalendar--datetime-to-diary-date datetime)
309 "31 12 2008"))
310 (setq calendar-date-style 'american)
311 (should (string= (icalendar--datetime-to-diary-date datetime)
312 "12 31 2008"))))
314 (ert-deftest icalendar--datestring-to-isodate ()
315 "Test method for `icalendar--datestring-to-isodate'."
316 (let ((calendar-date-style 'iso))
317 ;; numeric iso
318 (should (string= (icalendar--datestring-to-isodate "2008 05 11")
319 "20080511"))
320 (should (string= (icalendar--datestring-to-isodate "2008 05 31")
321 "20080531"))
322 (should (string= (icalendar--datestring-to-isodate "2008 05 31" 2)
323 "20080602"))
325 ;; numeric european
326 (setq calendar-date-style 'european)
327 (should (string= (icalendar--datestring-to-isodate "11 05 2008")
328 "20080511"))
329 (should (string= (icalendar--datestring-to-isodate "31 05 2008")
330 "20080531"))
331 (should (string= (icalendar--datestring-to-isodate "31 05 2008" 2)
332 "20080602"))
334 ;; numeric american
335 (setq calendar-date-style 'american)
336 (should (string= (icalendar--datestring-to-isodate "11 05 2008")
337 "20081105"))
338 (should (string= (icalendar--datestring-to-isodate "12 30 2008")
339 "20081230"))
340 (should (string= (icalendar--datestring-to-isodate "12 30 2008" 2)
341 "20090101"))
343 ;; non-numeric
344 (setq calendar-date-style nil) ;not necessary for conversion
345 (should (string= (icalendar--datestring-to-isodate "Nov 05 2008")
346 "20081105"))
347 (should (string= (icalendar--datestring-to-isodate "05 Nov 2008")
348 "20081105"))
349 (should (string= (icalendar--datestring-to-isodate "2008 Nov 05")
350 "20081105"))))
352 (ert-deftest icalendar--first-weekday-of-year ()
353 "Test method for `icalendar-first-weekday-of-year'."
354 (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
355 (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
356 (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
357 (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
358 (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
359 (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
360 (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
361 (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
362 (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
364 (ert-deftest icalendar--import-format-sample ()
365 "Test method for `icalendar-import-format-sample'."
366 (should (string= (icalendar-import-format-sample
367 (icalendar-tests--get-ical-event "BEGIN:VEVENT
368 DTSTAMP:20030509T043439Z
369 DTSTART:20030509T103000
370 SUMMARY:a
371 ORGANIZER:d
372 LOCATION:c
373 DTEND:20030509T153000
374 DESCRIPTION:b
375 END:VEVENT
377 (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
378 "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'"))))
380 (ert-deftest icalendar--format-ical-event ()
381 "Test `icalendar--format-ical-event'."
382 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
383 (icalendar-import-format-summary "SUM %s")
384 (icalendar-import-format-location " LOC %s")
385 (icalendar-import-format-description " DES %s")
386 (icalendar-import-format-organizer " ORG %s")
387 (icalendar-import-format-status " STA %s")
388 (icalendar-import-format-url " URL %s")
389 (icalendar-import-format-class " CLA %s")
390 (event (icalendar-tests--get-ical-event "BEGIN:VEVENT
391 DTSTAMP:20030509T043439Z
392 DTSTART:20030509T103000
393 SUMMARY:sum
394 ORGANIZER:org
395 LOCATION:loc
396 DTEND:20030509T153000
397 DESCRIPTION:des
398 END:VEVENT
399 ")))
400 (should (string= (icalendar--format-ical-event event)
401 "SUM sum DES des LOC loc ORG org"))
402 (setq icalendar-import-format (lambda (&rest ignore)
403 "helloworld"))
404 (should (string= (icalendar--format-ical-event event)
405 "helloworld"))
406 (setq icalendar-import-format
407 (lambda (e)
408 (format "-%s-%s-%s-%s-%s-%s-%s-"
409 (icalendar--get-event-property event 'SUMMARY)
410 (icalendar--get-event-property event 'DESCRIPTION)
411 (icalendar--get-event-property event 'LOCATION)
412 (icalendar--get-event-property event 'ORGANIZER)
413 (icalendar--get-event-property event 'STATUS)
414 (icalendar--get-event-property event 'URL)
415 (icalendar--get-event-property event 'CLASS))))
416 (should (string= (icalendar--format-ical-event event)
417 "-sum-des-loc-org-nil-nil-nil-"))))
419 (ert-deftest icalendar--parse-summary-and-rest ()
420 "Test `icalendar--parse-summary-and-rest'."
421 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
422 (icalendar-import-format-summary "SUM %s")
423 (icalendar-import-format-location " LOC %s")
424 (icalendar-import-format-description " DES %s")
425 (icalendar-import-format-organizer " ORG %s")
426 (icalendar-import-format-status " STA %s")
427 (icalendar-import-format-url " URL %s")
428 (icalendar-import-format-class " CLA %s")
429 (result))
430 (setq result (icalendar--parse-summary-and-rest "SUM sum ORG org"))
431 (should (string= (cdr (assoc 'org result)) "org"))
433 (setq result (icalendar--parse-summary-and-rest
434 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
435 (should (string= (cdr (assoc 'des result)) "des"))
436 (should (string= (cdr (assoc 'loc result)) "loc"))
437 (should (string= (cdr (assoc 'org result)) "org"))
438 (should (string= (cdr (assoc 'sta result)) "sta"))
439 (should (string= (cdr (assoc 'cla result)) "cla"))
441 (setq icalendar-import-format (lambda () "Hello world"))
442 (setq result (icalendar--parse-summary-and-rest
443 "blah blah "))
444 (should (not result))
447 ;; ======================================================================
448 ;; Export tests
449 ;; ======================================================================
451 (defun icalendar-tests--test-export (input-iso input-european input-american
452 expected-output)
453 "Perform an export test.
454 Argument INPUT-ISO iso style diary string.
455 Argument INPUT-EUROPEAN european style diary string.
456 Argument INPUT-AMERICAN american style diary string.
457 Argument EXPECTED-OUTPUT expected icalendar result string.
459 European style input data must use german month names. American
460 and ISO style input data must use english month names."
461 (let ((tz (cadr (current-time-zone)))
462 (calendar-date-style 'iso)
463 (icalendar-recurring-start-year 2000))
464 (unwind-protect
465 (progn
466 (set-time-zone-rule "CET")
467 (when input-iso
468 (let ((calendar-month-name-array
469 ["January" "February" "March" "April" "May" "June" "July" "August"
470 "September" "October" "November" "December"])
471 (calendar-day-name-array
472 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
473 "Saturday"]))
474 (setq calendar-date-style 'iso)
475 (icalendar-tests--do-test-export input-iso expected-output)))
476 (when input-european
477 (let ((calendar-month-name-array
478 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
479 "September" "Oktober" "November" "Dezember"])
480 (calendar-day-name-array
481 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
482 "Samstag"]))
483 (setq calendar-date-style 'european)
484 (icalendar-tests--do-test-export input-european expected-output)))
485 (when input-american
486 (let ((calendar-month-name-array
487 ["January" "February" "March" "April" "May" "June" "July" "August"
488 "September" "October" "November" "December"])
489 (calendar-day-name-array
490 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
491 "Saturday"]))
492 (setq calendar-date-style 'american)
493 (icalendar-tests--do-test-export input-american expected-output))))
494 ;; restore time-zone if something went terribly wrong
495 (set-time-zone-rule tz))))
497 (defun icalendar-tests--do-test-export (input expected-output)
498 "Actually perform export test.
499 Argument INPUT input diary string.
500 Argument EXPECTED-OUTPUT expected icalendar result string."
501 (let ((temp-file (make-temp-file "icalendar-tests-ics")))
502 (unwind-protect
503 (progn
504 (with-temp-buffer
505 (insert input)
506 (icalendar-export-region (point-min) (point-max) temp-file))
507 (save-excursion
508 (find-file temp-file)
509 (goto-char (point-min))
510 (cond (expected-output
511 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
512 PRODID:-//Emacs//NONSGML icalendar.el//EN
513 VERSION:2.0
514 BEGIN:VEVENT
515 UID:emacs[0-9]+
516 \\(\\(.\\|\n\\)+\\)
517 END:VEVENT
518 END:VCALENDAR
519 \\s-*$"
520 nil t))
521 (should (string-match
522 (concat "^\\s-*"
523 (regexp-quote (buffer-substring-no-properties
524 (match-beginning 1) (match-end 1)))
525 "\\s-*$")
526 expected-output)))
528 (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
529 PRODID:-//Emacs//NONSGML icalendar.el//EN
530 VERSION:2.0
531 END:VCALENDAR
532 \\s-*$"
533 nil t))))))
534 ;; cleanup!!
535 (kill-buffer (find-buffer-visiting temp-file))
536 (delete-file temp-file))))
538 (ert-deftest icalendar-export-ordinary-no-time ()
539 "Perform export test."
541 (let ((icalendar-export-hidden-diary-entries nil))
542 (icalendar-tests--test-export
543 "&2000 Oct 3 ordinary no time "
544 "&3 Okt 2000 ordinary no time "
545 "&Oct 3 2000 ordinary no time "
546 nil))
548 (icalendar-tests--test-export
549 "2000 Oct 3 ordinary no time "
550 "3 Okt 2000 ordinary no time "
551 "Oct 3 2000 ordinary no time "
552 "DTSTART;VALUE=DATE:20001003
553 DTEND;VALUE=DATE:20001004
554 SUMMARY:ordinary no time
557 (ert-deftest icalendar-export-ordinary ()
558 "Perform export test."
560 (icalendar-tests--test-export
561 "2000 Oct 3 16:30 ordinary with time"
562 "3 Okt 2000 16:30 ordinary with time"
563 "Oct 3 2000 16:30 ordinary with time"
564 "DTSTART;VALUE=DATE-TIME:20001003T163000
565 DTEND;VALUE=DATE-TIME:20001003T173000
566 SUMMARY:ordinary with time
568 (icalendar-tests--test-export
569 "2000 10 3 16:30 ordinary with time 2"
570 "3 10 2000 16:30 ordinary with time 2"
571 "10 3 2000 16:30 ordinary with time 2"
572 "DTSTART;VALUE=DATE-TIME:20001003T163000
573 DTEND;VALUE=DATE-TIME:20001003T173000
574 SUMMARY:ordinary with time 2
577 (icalendar-tests--test-export
578 "2000/10/3 16:30 ordinary with time 3"
579 "3/10/2000 16:30 ordinary with time 3"
580 "10/3/2000 16:30 ordinary with time 3"
581 "DTSTART;VALUE=DATE-TIME:20001003T163000
582 DTEND;VALUE=DATE-TIME:20001003T173000
583 SUMMARY:ordinary with time 3
586 (ert-deftest icalendar-export-multiline ()
587 "Perform export test."
589 ;; multiline -- FIXME!!!
590 (icalendar-tests--test-export
591 "2000 October 3 16:30 multiline
592 17:30 multiline continued FIXME"
593 "3 Oktober 2000 16:30 multiline
594 17:30 multiline continued FIXME"
595 "October 3 2000 16:30 multiline
596 17:30 multiline continued FIXME"
597 "DTSTART;VALUE=DATE-TIME:20001003T163000
598 DTEND;VALUE=DATE-TIME:20001003T173000
599 SUMMARY:multiline
600 DESCRIPTION:
601 17:30 multiline continued FIXME
604 (ert-deftest icalendar-export-weekly-by-day ()
605 "Perform export test."
607 ;; weekly by day
608 (icalendar-tests--test-export
609 "Monday 1:30pm weekly by day with start time"
610 "Montag 13:30 weekly by day with start time"
611 "Monday 1:30pm weekly by day with start time"
612 "DTSTART;VALUE=DATE-TIME:20000103T133000
613 DTEND;VALUE=DATE-TIME:20000103T143000
614 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
615 SUMMARY:weekly by day with start time
618 (icalendar-tests--test-export
619 "Monday 13:30-15:00 weekly by day with start and end time"
620 "Montag 13:30-15:00 weekly by day with start and end time"
621 "Monday 01:30pm-03:00pm weekly by day with start and end time"
622 "DTSTART;VALUE=DATE-TIME:20000103T133000
623 DTEND;VALUE=DATE-TIME:20000103T150000
624 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
625 SUMMARY:weekly by day with start and end time
628 (ert-deftest icalendar-export-yearly ()
629 "Perform export test."
630 ;; yearly
631 (icalendar-tests--test-export
632 "may 1 yearly no time"
633 "1 Mai yearly no time"
634 "may 1 yearly no time"
635 "DTSTART;VALUE=DATE:19000501
636 DTEND;VALUE=DATE:19000502
637 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
638 SUMMARY:yearly no time
641 (ert-deftest icalendar-export-anniversary ()
642 "Perform export test."
643 ;; anniversaries
644 (icalendar-tests--test-export
645 "%%(diary-anniversary 1989 10 3) anniversary no time"
646 "%%(diary-anniversary 3 10 1989) anniversary no time"
647 "%%(diary-anniversary 10 3 1989) anniversary no time"
648 "DTSTART;VALUE=DATE:19891003
649 DTEND;VALUE=DATE:19891004
650 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
651 SUMMARY:anniversary no time
653 (icalendar-tests--test-export
654 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
655 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
656 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
657 "DTSTART;VALUE=DATE-TIME:19891003T190000
658 DTEND;VALUE=DATE-TIME:19891004T200000
659 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
660 SUMMARY:anniversary with time
663 (ert-deftest icalendar-export-block ()
664 "Perform export test."
665 ;; block
666 (icalendar-tests--test-export
667 "%%(diary-block 2001 6 18 2001 7 6) block no time"
668 "%%(diary-block 18 6 2001 6 7 2001) block no time"
669 "%%(diary-block 6 18 2001 7 6 2001) block no time"
670 "DTSTART;VALUE=DATE:20010618
671 DTEND;VALUE=DATE:20010707
672 SUMMARY:block no time
674 (icalendar-tests--test-export
675 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
676 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
677 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
678 "DTSTART;VALUE=DATE-TIME:20010618T130000
679 DTEND;VALUE=DATE-TIME:20010618T170000
680 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
681 SUMMARY:block with time
683 (icalendar-tests--test-export
684 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
685 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
686 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
687 "DTSTART;VALUE=DATE-TIME:20010618T130000
688 DTEND;VALUE=DATE-TIME:20010618T140000
689 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
690 SUMMARY:block no end time
693 ;; ======================================================================
694 ;; Import tests
695 ;; ======================================================================
697 (defun icalendar-tests--test-import (input expected-iso expected-european
698 expected-american)
699 "Perform import test.
700 Argument INPUT icalendar event string.
701 Argument EXPECTED-ISO expected iso style diary string.
702 Argument EXPECTED-EUROPEAN expected european style diary string.
703 Argument EXPECTED-AMERICAN expected american style diary string."
704 (let ((timezone (cadr (current-time-zone))))
705 (set-time-zone-rule "CET")
706 (with-temp-buffer
707 (if (string-match "^BEGIN:VCALENDAR" input)
708 (insert input)
709 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
710 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
711 (insert input)
712 (unless (eq (char-before) ?\n)
713 (insert "\n"))
714 (insert "END:VEVENT\nEND:VCALENDAR\n"))
715 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
716 (icalendar-import-format-summary "%s")
717 (icalendar-import-format-location "\n Location: %s")
718 (icalendar-import-format-description "\n Desc: %s")
719 (icalendar-import-format-organizer "\n Organizer: %s")
720 (icalendar-import-format-status "\n Status: %s")
721 (icalendar-import-format-url "\n URL: %s")
722 (icalendar-import-format-class "\n Class: %s")
723 calendar-date-style)
724 (when expected-iso
725 (setq calendar-date-style 'iso)
726 (icalendar-tests--do-test-import input expected-iso))
727 (when expected-european
728 (setq calendar-date-style 'european)
729 (icalendar-tests--do-test-import input expected-european))
730 (when expected-american
731 (setq calendar-date-style 'american)
732 (icalendar-tests--do-test-import input expected-american))))
733 (set-time-zone-rule timezone)))
735 (defun icalendar-tests--do-test-import (input expected-output)
736 "Actually perform import test.
737 Argument INPUT input icalendar string.
738 Argument EXPECTED-OUTPUT expected diary string."
739 (let ((temp-file (make-temp-file "icalendar-test-diary")))
740 (icalendar-import-buffer temp-file t t)
741 (unwind-protect
742 (save-excursion
743 (find-file temp-file)
744 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
745 (should (icalendar-tests--compare-strings result
746 expected-output))))
747 (kill-buffer (find-buffer-visiting temp-file))
748 (delete-file temp-file))))
750 (ert-deftest icalendar-import-non-recurring ()
751 "Perform standard import tests."
752 (icalendar-tests--test-import
753 "SUMMARY:non-recurring
754 DTSTART;VALUE=DATE-TIME:20030919T090000
755 DTEND;VALUE=DATE-TIME:20030919T113000"
756 "&2003/9/19 09:00-11:30 non-recurring"
757 "&19/9/2003 09:00-11:30 non-recurring"
758 "&9/19/2003 09:00-11:30 non-recurring")
759 (icalendar-tests--test-import
760 "SUMMARY:non-recurring allday
761 DTSTART;VALUE=DATE-TIME:20030919"
762 "&2003/9/19 non-recurring allday"
763 "&19/9/2003 non-recurring allday"
764 "&9/19/2003 non-recurring allday")
765 (icalendar-tests--test-import
766 ;; do not remove the trailing blank after "long"!
767 "SUMMARY:long
768 summary
769 DTSTART;VALUE=DATE:20030919"
770 "&2003/9/19 long summary"
771 "&19/9/2003 long summary"
772 "&9/19/2003 long summary")
773 (icalendar-tests--test-import
774 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
775 SUMMARY:Sommerferien
776 STATUS:TENTATIVE
777 CLASS:PRIVATE
778 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
779 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
780 DTSTART;VALUE=DATE:20040719
781 DTEND;VALUE=DATE:20040828
782 DTSTAMP:20031103T011641Z
784 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
785 Status: TENTATIVE
786 Class: PRIVATE
788 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
789 Status: TENTATIVE
790 Class: PRIVATE
792 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
793 Status: TENTATIVE
794 Class: PRIVATE")
795 (icalendar-tests--test-import
796 "UID
797 :04979712-3902-11d9-93dd-8f9f4afe08da
798 SUMMARY
799 :folded summary
800 STATUS
801 :TENTATIVE
802 CLASS
803 :PRIVATE
804 X-MOZILLA-ALARM-DEFAULT-LENGTH
806 DTSTART
807 :20041123T140000
808 DTEND
809 :20041123T143000
810 DTSTAMP
811 :20041118T013430Z
812 LAST-MODIFIED
813 :20041118T013640Z
815 "&2004/11/23 14:00-14:30 folded summary
816 Status: TENTATIVE
817 Class: PRIVATE"
818 "&23/11/2004 14:00-14:30 folded summary
819 Status: TENTATIVE
820 Class: PRIVATE"
821 "&11/23/2004 14:00-14:30 folded summary
822 Status: TENTATIVE
823 Class: PRIVATE")
825 (icalendar-tests--test-import
826 "UID
827 :6161a312-3902-11d9-b512-f764153bb28b
828 SUMMARY
829 :another example
830 STATUS
831 :TENTATIVE
832 CLASS
833 :PRIVATE
834 X-MOZILLA-ALARM-DEFAULT-LENGTH
836 DTSTART
837 :20041123T144500
838 DTEND
839 :20041123T154500
840 DTSTAMP
841 :20041118T013641Z
843 "&2004/11/23 14:45-15:45 another example
844 Status: TENTATIVE
845 Class: PRIVATE"
846 "&23/11/2004 14:45-15:45 another example
847 Status: TENTATIVE
848 Class: PRIVATE"
849 "&11/23/2004 14:45-15:45 another example
850 Status: TENTATIVE
851 Class: PRIVATE"))
853 (ert-deftest icalendar-import-rrule ()
854 (icalendar-tests--test-import
855 "SUMMARY:rrule daily
856 DTSTART;VALUE=DATE-TIME:20030919T090000
857 DTEND;VALUE=DATE-TIME:20030919T113000
858 RRULE:FREQ=DAILY;
860 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily"
861 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily"
862 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily")
863 ;; RRULE examples
864 (icalendar-tests--test-import
865 "SUMMARY:rrule daily
866 DTSTART;VALUE=DATE-TIME:20030919T090000
867 DTEND;VALUE=DATE-TIME:20030919T113000
868 RRULE:FREQ=DAILY;INTERVAL=2
870 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily"
871 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily"
872 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily")
873 (icalendar-tests--test-import
874 "SUMMARY:rrule daily with exceptions
875 DTSTART;VALUE=DATE-TIME:20030919T090000
876 DTEND;VALUE=DATE-TIME:20030919T113000
877 RRULE:FREQ=DAILY;INTERVAL=2
878 EXDATE:20030921,20030925
880 "&%%(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"
881 "&%%(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"
882 "&%%(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")
883 (icalendar-tests--test-import
884 "SUMMARY:rrule weekly
885 DTSTART;VALUE=DATE-TIME:20030919T090000
886 DTEND;VALUE=DATE-TIME:20030919T113000
887 RRULE:FREQ=WEEKLY;
889 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly"
890 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly"
891 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly")
892 (icalendar-tests--test-import
893 "SUMMARY:rrule monthly no end
894 DTSTART;VALUE=DATE-TIME:20030919T090000
895 DTEND;VALUE=DATE-TIME:20030919T113000
896 RRULE:FREQ=MONTHLY;
898 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end"
899 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end"
900 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end")
901 (icalendar-tests--test-import
902 "SUMMARY:rrule monthly with end
903 DTSTART;VALUE=DATE-TIME:20030919T090000
904 DTEND;VALUE=DATE-TIME:20030919T113000
905 RRULE:FREQ=MONTHLY;UNTIL=20050819;
907 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end"
908 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end"
909 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end")
910 (icalendar-tests--test-import
911 "DTSTART;VALUE=DATE:20040815
912 DTEND;VALUE=DATE:20040816
913 SUMMARY:Maria Himmelfahrt
914 UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
915 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
917 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt"
918 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt"
919 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt")
920 (icalendar-tests--test-import
921 "SUMMARY:rrule yearly
922 DTSTART;VALUE=DATE-TIME:20030919T090000
923 DTEND;VALUE=DATE-TIME:20030919T113000
924 RRULE:FREQ=YEARLY;INTERVAL=2
926 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly" ;FIXME
927 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly" ;FIXME
928 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly") ;FIXME
929 (icalendar-tests--test-import
930 "SUMMARY:rrule count daily short
931 DTSTART;VALUE=DATE-TIME:20030919T090000
932 DTEND;VALUE=DATE-TIME:20030919T113000
933 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
935 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short"
936 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short"
937 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short")
938 (icalendar-tests--test-import
939 "SUMMARY:rrule count daily long
940 DTSTART;VALUE=DATE-TIME:20030919T090000
941 DTEND;VALUE=DATE-TIME:20030919T113000
942 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
944 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long"
945 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long"
946 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long")
947 (icalendar-tests--test-import
948 "SUMMARY:rrule count bi-weekly 3 times
949 DTSTART;VALUE=DATE-TIME:20030919T090000
950 DTEND;VALUE=DATE-TIME:20030919T113000
951 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
953 "&%%(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"
954 "&%%(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"
955 "&%%(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")
956 (icalendar-tests--test-import
957 "SUMMARY:rrule count monthly
958 DTSTART;VALUE=DATE-TIME:20030919T090000
959 DTEND;VALUE=DATE-TIME:20030919T113000
960 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
962 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly"
963 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly"
964 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly")
965 (icalendar-tests--test-import
966 "SUMMARY:rrule count every second month
967 DTSTART;VALUE=DATE-TIME:20030919T090000
968 DTEND;VALUE=DATE-TIME:20030919T113000
969 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
971 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month" ;FIXME
972 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month" ;FIXME
973 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month") ;FIXME
974 (icalendar-tests--test-import
975 "SUMMARY:rrule count yearly
976 DTSTART;VALUE=DATE-TIME:20030919T090000
977 DTEND;VALUE=DATE-TIME:20030919T113000
978 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
980 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly"
981 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly"
982 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly")
983 (icalendar-tests--test-import
984 "SUMMARY:rrule count every second year
985 DTSTART;VALUE=DATE-TIME:20030919T090000
986 DTEND;VALUE=DATE-TIME:20030919T113000
987 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
989 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year" ;FIXME!!!
990 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year" ;FIXME!!!
991 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year") ;FIXME!!!
994 (ert-deftest icalendar-import-duration ()
995 ;; duration
996 (icalendar-tests--test-import
997 "DTSTART;VALUE=DATE:20050217
998 SUMMARY:duration
999 DURATION:P7D
1001 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration"
1002 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration"
1003 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration")
1004 (icalendar-tests--test-import
1005 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
1006 DTSTAMP:20041127T183315Z
1007 LAST-MODIFIED:20041127T183329
1008 SUMMARY:Urlaub
1009 DTSTART;VALUE=DATE:20011221
1010 DTEND;VALUE=DATE:20011221
1011 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
1012 CLASS:PUBLIC
1013 SEQUENCE:1
1014 CREATED:20041127T183329
1016 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
1017 Class: PUBLIC"
1018 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
1019 Class: PUBLIC"
1020 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
1021 Class: PUBLIC"))
1023 (ert-deftest icalendar-import-bug-6766 ()
1024 ;;bug#6766 -- multiple byday values in a weekly rrule
1025 (icalendar-tests--test-import
1026 "CLASS:PUBLIC
1027 DTEND;TZID=America/New_York:20100421T120000
1028 DTSTAMP:20100525T141214Z
1029 DTSTART;TZID=America/New_York:20100421T113000
1030 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
1031 SEQUENCE:1
1032 STATUS:CONFIRMED
1033 SUMMARY:Scrum
1034 TRANSP:OPAQUE
1035 UID:8814e3f9-7482-408f-996c-3bfe486a1262
1036 END:VEVENT
1037 BEGIN:VEVENT
1038 CLASS:PUBLIC
1039 DTSTAMP:20100525T141214Z
1040 DTSTART;VALUE=DATE:20100422
1041 DTEND;VALUE=DATE:20100423
1042 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
1043 SEQUENCE:1
1044 SUMMARY:Tues + Thurs thinking
1045 TRANSP:OPAQUE
1046 UID:8814e3f9-7482-408f-996c-3bfe486a1263
1048 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1049 Status: CONFIRMED
1050 Class: PUBLIC
1051 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1052 Class: PUBLIC"
1054 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1055 Status: CONFIRMED
1056 Class: PUBLIC
1057 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1058 Class: PUBLIC"
1060 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1061 Status: CONFIRMED
1062 Class: PUBLIC
1063 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1064 Class: PUBLIC"))
1067 ;; ======================================================================
1068 ;; Cycle
1069 ;; ======================================================================
1070 (defun icalendar-tests--test-cycle (input)
1071 "Perform cycle test.
1072 Argument INPUT icalendar event string."
1073 (with-temp-buffer
1074 (if (string-match "^BEGIN:VCALENDAR" input)
1075 (insert input)
1076 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
1077 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
1078 (insert input)
1079 (unless (eq (char-before) ?\n)
1080 (insert "\n"))
1081 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1082 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
1083 (icalendar-import-format-summary "%s")
1084 (icalendar-import-format-location "\n Location: %s")
1085 (icalendar-import-format-description "\n Desc: %s")
1086 (icalendar-import-format-organizer "\n Organizer: %s")
1087 (icalendar-import-format-status "\n Status: %s")
1088 (icalendar-import-format-url "\n URL: %s")
1089 (icalendar-import-format-class "\n Class: %s"))
1090 (dolist (calendar-date-style '(iso european american))
1091 (icalendar-tests--do-test-cycle)))))
1093 (defun icalendar-tests--do-test-cycle ()
1094 "Actually perform import/export cycle test."
1095 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
1096 (temp-ics (make-temp-file "icalendar-test-ics"))
1097 (org-input (buffer-substring-no-properties (point-min) (point-max))))
1099 (unwind-protect
1100 (progn
1101 ;; step 1: import
1102 (icalendar-import-buffer temp-diary t t)
1104 ;; step 2: export what was just imported
1105 (save-excursion
1106 (find-file temp-diary)
1107 (icalendar-export-region (point-min) (point-max) temp-ics))
1109 ;; compare the output of step 2 with the input of step 1
1110 (save-excursion
1111 (find-file temp-ics)
1112 (goto-char (point-min))
1113 (when (re-search-forward "\nUID:.*\n" nil t)
1114 (replace-match "\n"))
1115 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1116 (should (icalendar-tests--compare-strings cycled org-input)))))
1117 ;; clean up
1118 (kill-buffer (find-buffer-visiting temp-diary))
1119 (save-excursion
1120 (set-buffer (find-buffer-visiting temp-ics))
1121 (set-buffer-modified-p nil)
1122 (kill-buffer (current-buffer)))
1123 (delete-file temp-diary)
1124 (delete-file temp-ics))))
1126 (ert-deftest icalendar-cycle ()
1127 "Perform cycling tests."
1128 (icalendar-tests--test-cycle
1129 "DTSTART;VALUE=DATE-TIME:20030919T090000
1130 DTEND;VALUE=DATE-TIME:20030919T113000
1131 SUMMARY:Cycletest
1133 (icalendar-tests--test-cycle
1134 "DTSTART;VALUE=DATE-TIME:20030919T090000
1135 DTEND;VALUE=DATE-TIME:20030919T113000
1136 SUMMARY:Cycletest
1137 DESCRIPTION:beschreibung!
1138 LOCATION:nowhere
1139 ORGANIZER:ulf
1141 (icalendar-tests--test-cycle
1142 "DTSTART;VALUE=DATE:19190909
1143 DTEND;VALUE=DATE:19190910
1144 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1145 SUMMARY:and diary-anniversary
1148 ;; ======================================================================
1149 ;; Real world
1150 ;; ======================================================================
1151 (ert-deftest icalendar-real-world ()
1152 "Perform real-world tests, as gathered from problem reports."
1153 ;; 2003-05-29
1154 (icalendar-tests--test-import
1155 "BEGIN:VCALENDAR
1156 METHOD:REQUEST
1157 PRODID:Microsoft CDO for Microsoft Exchange
1158 VERSION:2.0
1159 BEGIN:VTIMEZONE
1160 TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
1161 X-MICROSOFT-CDO-TZID:23
1162 BEGIN:STANDARD
1163 DTSTART:16010101T000000
1164 TZOFFSETFROM:+0530
1165 TZOFFSETTO:+0530
1166 END:STANDARD
1167 BEGIN:DAYLIGHT
1168 DTSTART:16010101T000000
1169 TZOFFSETFROM:+0530
1170 TZOFFSETTO:+0530
1171 END:DAYLIGHT
1172 END:VTIMEZONE
1173 BEGIN:VEVENT
1174 DTSTAMP:20030509T043439Z
1175 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
1176 SUMMARY:On-Site Interview
1177 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
1178 010000000DB823520692542408ED02D7023F9DFF9
1179 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
1180 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
1181 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
1182 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
1183 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
1184 zz\":MAILTO:zzzzzz@zzzzzzz.com
1185 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
1186 LOCATION:Cccc
1187 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
1188 DESCRIPTION:10:30am - Blah
1189 SEQUENCE:0
1190 PRIORITY:5
1191 CLASS:
1192 CREATED:20030509T043439Z
1193 LAST-MODIFIED:20030509T043459Z
1194 STATUS:CONFIRMED
1195 TRANSP:OPAQUE
1196 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1197 X-MICROSOFT-CDO-INSTTYPE:0
1198 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1199 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1200 X-MICROSOFT-CDO-IMPORTANCE:1
1201 X-MICROSOFT-CDO-OWNERAPPTID:126441427
1202 BEGIN:VALARM
1203 ACTION:DISPLAY
1204 DESCRIPTION:REMINDER
1205 TRIGGER;RELATED=START:-PT00H15M00S
1206 END:VALARM
1207 END:VEVENT
1208 END:VCALENDAR"
1210 "&9/5/2003 10:30-15:30 On-Site Interview
1211 Desc: 10:30am - Blah
1212 Location: Cccc
1213 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1214 Status: CONFIRMED"
1215 "&5/9/2003 10:30-15:30 On-Site Interview
1216 Desc: 10:30am - Blah
1217 Location: Cccc
1218 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1219 Status: CONFIRMED")
1221 ;; 2003-06-18 a
1222 (icalendar-tests--test-import
1223 "DTSTAMP:20030618T195512Z
1224 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
1225 SUMMARY:Dress Rehearsal for XXXX-XXXX
1226 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1227 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1228 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
1229 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
1230 ORGANIZER;CN=\"ABCD,TECHTRAINING
1231 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
1232 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
1233 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
1234 DESCRIPTION:753 Zeichen hier radiert
1235 SEQUENCE:0
1236 PRIORITY:5
1237 CLASS:
1238 CREATED:20030618T195518Z
1239 LAST-MODIFIED:20030618T195527Z
1240 STATUS:CONFIRMED
1241 TRANSP:OPAQUE
1242 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1243 X-MICROSOFT-CDO-INSTTYPE:0
1244 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1245 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1246 X-MICROSOFT-CDO-IMPORTANCE:1
1247 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1248 BEGIN:VALARM
1249 ACTION:DISPLAY
1250 DESCRIPTION:REMINDER
1251 TRIGGER;RELATED=START:-PT00H15M00S
1252 END:VALARM"
1254 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1255 Desc: 753 Zeichen hier radiert
1256 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1257 Organizer: MAILTO:xxx@xxxxx.com
1258 Status: CONFIRMED"
1259 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1260 Desc: 753 Zeichen hier radiert
1261 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1262 Organizer: MAILTO:xxx@xxxxx.com
1263 Status: CONFIRMED")
1264 ;; 2003-06-18 b -- uses timezone
1265 (icalendar-tests--test-import
1266 "BEGIN:VCALENDAR
1267 METHOD:REQUEST
1268 PRODID:Microsoft CDO for Microsoft Exchange
1269 VERSION:2.0
1270 BEGIN:VTIMEZONE
1271 TZID:Mountain Time (US & Canada)
1272 X-MICROSOFT-CDO-TZID:12
1273 BEGIN:STANDARD
1274 DTSTART:16010101T020000
1275 TZOFFSETFROM:-0600
1276 TZOFFSETTO:-0700
1277 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
1278 END:STANDARD
1279 BEGIN:DAYLIGHT
1280 DTSTART:16010101T020000
1281 TZOFFSETFROM:-0700
1282 TZOFFSETTO:-0600
1283 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
1284 END:DAYLIGHT
1285 END:VTIMEZONE
1286 BEGIN:VEVENT
1287 DTSTAMP:20030618T230323Z
1288 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
1289 SUMMARY:Updated: Dress Rehearsal for ABC01-15
1290 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1291 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1292 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
1293 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
1294 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
1295 .com
1296 ORGANIZER;CN=\"ABCD,TECHTRAINING
1297 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
1298 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
1299 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
1300 DESCRIPTION:Viele Zeichen standen hier früher
1301 SEQUENCE:0
1302 PRIORITY:5
1303 CLASS:
1304 CREATED:20030618T230326Z
1305 LAST-MODIFIED:20030618T230335Z
1306 STATUS:CONFIRMED
1307 TRANSP:OPAQUE
1308 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1309 X-MICROSOFT-CDO-INSTTYPE:0
1310 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1311 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1312 X-MICROSOFT-CDO-IMPORTANCE:1
1313 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1314 BEGIN:VALARM
1315 ACTION:DISPLAY
1316 DESCRIPTION:REMINDER
1317 TRIGGER;RELATED=START:-PT00H15M00S
1318 END:VALARM
1319 END:VEVENT
1320 END:VCALENDAR"
1322 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1323 Desc: Viele Zeichen standen hier früher
1324 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1325 Organizer: MAILTO:bbb@bbbbb.com
1326 Status: CONFIRMED"
1327 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1328 Desc: Viele Zeichen standen hier früher
1329 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1330 Organizer: MAILTO:bbb@bbbbb.com
1331 Status: CONFIRMED")
1332 ;; export 2004-10-28 block entries
1333 (icalendar-tests--test-export
1336 "-*- mode: text; fill-column: 256;-*-
1338 >>> block entries:
1340 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1342 "DTSTART;VALUE=DATE:20041108
1343 DTEND;VALUE=DATE:20041111
1344 SUMMARY:Nov 8-10 aa")
1346 (icalendar-tests--test-export
1349 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1350 "DTSTART;VALUE=DATE:20041213
1351 DTEND;VALUE=DATE:20041218
1352 SUMMARY:Dec 13-17 bb")
1354 (icalendar-tests--test-export
1357 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1358 "DTSTART;VALUE=DATE:20050203
1359 DTEND;VALUE=DATE:20050205
1360 SUMMARY:Feb 3-4 cc")
1362 (icalendar-tests--test-export
1365 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1366 "DTSTART;VALUE=DATE:20050424
1367 DTEND;VALUE=DATE:20050430
1368 SUMMARY:April 24-29 dd
1370 (icalendar-tests--test-export
1373 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1374 "DTSTART;VALUE=DATE:20050530
1375 DTEND;VALUE=DATE:20050602
1376 SUMMARY:may 30 - June 1: ee")
1378 (icalendar-tests--test-export
1381 "%%(diary-block 6 6 2005 6 8 2005) ff"
1382 "DTSTART;VALUE=DATE:20050606
1383 DTEND;VALUE=DATE:20050609
1384 SUMMARY:ff")
1386 ;; export 2004-10-28 anniversary entries
1387 (icalendar-tests--test-export
1391 >>> anniversaries:
1393 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1394 "DTSTART;VALUE=DATE:19910328
1395 DTEND;VALUE=DATE:19910329
1396 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1397 SUMMARY:aa birthday (%d years old)
1400 (icalendar-tests--test-export
1403 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1404 "DTSTART;VALUE=DATE:19570517
1405 DTEND;VALUE=DATE:19570518
1406 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1407 SUMMARY:bb birthday (%d years old)")
1409 (icalendar-tests--test-export
1412 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1413 "DTSTART;VALUE=DATE:19970608
1414 DTEND;VALUE=DATE:19970609
1415 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1416 SUMMARY:cc birthday (%d years old)")
1418 (icalendar-tests--test-export
1421 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1422 "DTSTART;VALUE=DATE:19830722
1423 DTEND;VALUE=DATE:19830723
1424 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1425 SUMMARY:dd (%d years ago...!)")
1427 (icalendar-tests--test-export
1430 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1431 "DTSTART;VALUE=DATE:19880801
1432 DTEND;VALUE=DATE:19880802
1433 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1434 SUMMARY:ee birthday (%d years old)")
1436 (icalendar-tests--test-export
1439 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1440 "DTSTART;VALUE=DATE:19570921
1441 DTEND;VALUE=DATE:19570922
1442 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1443 SUMMARY:ff birthday (%d years old)")
1446 ;; FIXME!
1448 ;; export 2004-10-28 monthly, weekly entries
1450 ;; (icalendar-tests--test-export
1451 ;; nil
1452 ;; "
1453 ;; >>> ------------ monthly:
1455 ;; */27/* 10:00 blah blah"
1456 ;; "xxx")
1458 (icalendar-tests--test-export
1461 ">>> ------------ my week:
1463 Monday 13:00 MAC"
1464 "DTSTART;VALUE=DATE-TIME:20000103T130000
1465 DTEND;VALUE=DATE-TIME:20000103T140000
1466 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1467 SUMMARY:MAC")
1469 (icalendar-tests--test-export
1472 "Monday 15:00 a1"
1473 "DTSTART;VALUE=DATE-TIME:20000103T150000
1474 DTEND;VALUE=DATE-TIME:20000103T160000
1475 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1476 SUMMARY:a1")
1479 (icalendar-tests--test-export
1482 "Monday 16:00-17:00 a2"
1483 "DTSTART;VALUE=DATE-TIME:20000103T160000
1484 DTEND;VALUE=DATE-TIME:20000103T170000
1485 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1486 SUMMARY:a2")
1488 (icalendar-tests--test-export
1491 "Tuesday 11:30-13:00 a3"
1492 "DTSTART;VALUE=DATE-TIME:20000104T113000
1493 DTEND;VALUE=DATE-TIME:20000104T130000
1494 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1495 SUMMARY:a3")
1497 (icalendar-tests--test-export
1500 "Tuesday 15:00 a4"
1501 "DTSTART;VALUE=DATE-TIME:20000104T150000
1502 DTEND;VALUE=DATE-TIME:20000104T160000
1503 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1504 SUMMARY:a4")
1506 (icalendar-tests--test-export
1509 "Wednesday 13:00 a5"
1510 "DTSTART;VALUE=DATE-TIME:20000105T130000
1511 DTEND;VALUE=DATE-TIME:20000105T140000
1512 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1513 SUMMARY:a5")
1515 (icalendar-tests--test-export
1518 "Wednesday 11:30-13:30 a6"
1519 "DTSTART;VALUE=DATE-TIME:20000105T113000
1520 DTEND;VALUE=DATE-TIME:20000105T133000
1521 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1522 SUMMARY:a6")
1524 (icalendar-tests--test-export
1527 "Wednesday 15:00 s1"
1528 "DTSTART;VALUE=DATE-TIME:20000105T150000
1529 DTEND;VALUE=DATE-TIME:20000105T160000
1530 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1531 SUMMARY:s1")
1534 ;; export 2004-10-28 regular entries
1535 (icalendar-tests--test-export
1539 >>> regular diary entries:
1541 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1542 "DTSTART;VALUE=DATE-TIME:20041012T140000
1543 DTEND;VALUE=DATE-TIME:20041012T150000
1544 SUMMARY:Tue: [2004-10-12] q1")
1546 ;; 2004-11-19
1547 (icalendar-tests--test-import
1548 "BEGIN:VCALENDAR
1549 VERSION
1550 :2.0
1551 PRODID
1552 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1553 BEGIN:VEVENT
1555 :04979712-3902-11d9-93dd-8f9f4afe08da
1556 SUMMARY
1557 :Jjjjj & Wwwww
1558 STATUS
1559 :TENTATIVE
1560 CLASS
1561 :PRIVATE
1562 X-MOZILLA-ALARM-DEFAULT-LENGTH
1564 DTSTART
1565 :20041123T140000
1566 DTEND
1567 :20041123T143000
1568 DTSTAMP
1569 :20041118T013430Z
1570 LAST-MODIFIED
1571 :20041118T013640Z
1572 END:VEVENT
1573 BEGIN:VEVENT
1575 :6161a312-3902-11d9-b512-f764153bb28b
1576 SUMMARY
1577 :BB Aaaaaaaa Bbbbb
1578 STATUS
1579 :TENTATIVE
1580 CLASS
1581 :PRIVATE
1582 X-MOZILLA-ALARM-DEFAULT-LENGTH
1584 DTSTART
1585 :20041123T144500
1586 DTEND
1587 :20041123T154500
1588 DTSTAMP
1589 :20041118T013641Z
1590 END:VEVENT
1591 BEGIN:VEVENT
1593 :943a4d7e-3902-11d9-9ce7-c9addeadf928
1594 SUMMARY
1595 :Hhhhhhhh
1596 STATUS
1597 :TENTATIVE
1598 CLASS
1599 :PRIVATE
1600 X-MOZILLA-ALARM-DEFAULT-LENGTH
1602 DTSTART
1603 :20041123T110000
1604 DTEND
1605 :20041123T120000
1606 DTSTAMP
1607 :20041118T013831Z
1608 END:VEVENT
1609 BEGIN:VEVENT
1611 :fe53615e-3902-11d9-9dd8-9d38a155bf41
1612 SUMMARY
1613 :MMM Aaaaaaaaa
1614 STATUS
1615 :TENTATIVE
1616 CLASS
1617 :PRIVATE
1618 X-MOZILLA-ALARM-DEFAULT-LENGTH
1620 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1622 RRULE
1623 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1624 DTSTART
1625 :20041112T140000
1626 DTEND
1627 :20041112T183000
1628 DTSTAMP
1629 :20041118T014117Z
1630 END:VEVENT
1631 BEGIN:VEVENT
1633 :87c928ee-3901-11d9-b21f-b45042155024
1634 SUMMARY
1635 :Rrrr/Cccccc ii Aaaaaaaa
1636 DESCRIPTION
1637 :Vvvvv Rrrr aaa Cccccc
1638 STATUS
1639 :TENTATIVE
1640 CLASS
1641 :PRIVATE
1642 X-MOZILLA-ALARM-DEFAULT-LENGTH
1644 DTSTART
1645 ;VALUE=DATE
1646 :20041119
1647 DTEND
1648 ;VALUE=DATE
1649 :20041120
1650 DTSTAMP
1651 :20041118T013107Z
1652 LAST-MODIFIED
1653 :20041118T014203Z
1654 END:VEVENT
1655 BEGIN:VEVENT
1657 :e8f331ae-3902-11d9-9948-dfdcb66a2872
1658 SUMMARY
1659 :Wwww aa hhhh
1660 STATUS
1661 :TENTATIVE
1662 CLASS
1663 :PRIVATE
1664 X-MOZILLA-ALARM-DEFAULT-LENGTH
1666 RRULE
1667 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1668 DTSTART
1669 ;VALUE=DATE
1670 :20041101
1671 DTEND
1672 ;VALUE=DATE
1673 :20041102
1674 DTSTAMP
1675 :20041118T014045Z
1676 LAST-MODIFIED
1677 :20041118T023846Z
1678 END:VEVENT
1679 END:VCALENDAR
1682 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
1683 Status: TENTATIVE
1684 Class: PRIVATE
1685 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1686 Status: TENTATIVE
1687 Class: PRIVATE
1688 &23/11/2004 11:00-12:00 Hhhhhhhh
1689 Status: TENTATIVE
1690 Class: PRIVATE
1691 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
1692 Status: TENTATIVE
1693 Class: PRIVATE
1694 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
1695 Desc: Vvvvv Rrrr aaa Cccccc
1696 Status: TENTATIVE
1697 Class: PRIVATE
1698 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
1699 Status: TENTATIVE
1700 Class: PRIVATE"
1701 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
1702 Status: TENTATIVE
1703 Class: PRIVATE
1704 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1705 Status: TENTATIVE
1706 Class: PRIVATE
1707 &11/23/2004 11:00-12:00 Hhhhhhhh
1708 Status: TENTATIVE
1709 Class: PRIVATE
1710 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
1711 Status: TENTATIVE
1712 Class: PRIVATE
1713 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
1714 Desc: Vvvvv Rrrr aaa Cccccc
1715 Status: TENTATIVE
1716 Class: PRIVATE
1717 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
1718 Status: TENTATIVE
1719 Class: PRIVATE")
1721 ;; 2004-09-09 pg
1722 (icalendar-tests--test-export
1723 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
1726 "DTSTART;VALUE=DATE:20040101
1727 DTEND;VALUE=DATE:20040105
1728 SUMMARY:Urlaub")
1730 ;; 2004-10-25 pg
1731 (icalendar-tests--test-export
1733 "5 11 2004 Bla Fasel"
1735 "DTSTART;VALUE=DATE:20041105
1736 DTEND;VALUE=DATE:20041106
1737 SUMMARY:Bla Fasel")
1739 ;; 2004-10-30 pg
1740 (icalendar-tests--test-export
1742 "2 Nov 2004 15:00-16:30 Zahnarzt"
1744 "DTSTART;VALUE=DATE-TIME:20041102T150000
1745 DTEND;VALUE=DATE-TIME:20041102T163000
1746 SUMMARY:Zahnarzt")
1748 ;; 2005-02-07 lt
1749 (icalendar-tests--test-import
1750 "UID
1751 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
1752 SUMMARY
1753 :Waitangi Day
1754 DESCRIPTION
1755 :abcdef
1756 CATEGORIES
1757 :Public Holiday
1758 STATUS
1759 :CONFIRMED
1760 CLASS
1761 :PRIVATE
1762 DTSTART
1763 ;VALUE=DATE
1764 :20050206
1765 DTEND
1766 ;VALUE=DATE
1767 :20050207
1768 DTSTAMP
1769 :20050128T011209Z"
1771 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
1772 Desc: abcdef
1773 Status: CONFIRMED
1774 Class: PRIVATE"
1775 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
1776 Desc: abcdef
1777 Status: CONFIRMED
1778 Class: PRIVATE")
1780 ;; 2005-03-01 lt
1781 (icalendar-tests--test-import
1782 "DTSTART;VALUE=DATE:20050217
1783 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
1784 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
1785 DTSTAMP:20050118T210335Z
1786 DURATION:P7D"
1788 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa"
1789 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa")
1791 ;; 2005-03-23 lt
1792 (icalendar-tests--test-export
1794 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
1796 "DTSTART;VALUE=DATE-TIME:20050208T160000
1797 DTEND;VALUE=DATE-TIME:20050208T164500
1798 RRULE:FREQ=DAILY;INTERVAL=7
1799 SUMMARY:[WORK] Pppp
1802 ;; 2005-05-27 eu
1803 (icalendar-tests--test-export
1806 ;; FIXME: colon not allowed!
1807 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
1808 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
1809 "DTSTART;VALUE=DATE:19001101
1810 DTEND;VALUE=DATE:19001102
1811 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
1812 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
1816 (provide 'icalendar-tests)
1817 ;;; icalendar-tests.el ends here