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