(decode_coding_utf_8): Check byte_after_cr before breaking the loop.
[bpt/emacs.git] / test / icalendar-testsuite.el
1 ;; icalendar-testsuite.el --- Test suite for icalendar.el
2
3 ;; Copyright (C) 2005, 2008 Free Software Foundation, Inc.
4
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
6 ;; Created: March 2005
7 ;; Keywords: calendar
8 ;; Human-Keywords: calendar, diary, iCalendar, vCalendar
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Commentary:
26
27 ;; TODO:
28 ;; - Add more unit tests for functions, timezone etc.
29
30 ;; Note: Watch the trailing blank that is added on import.
31
32 ;;; Code:
33 (defun icalendar-testsuite-run ()
34 "Run icalendar test suite."
35 (interactive)
36 (icalendar-testsuite--run-function-tests)
37 (icalendar-testsuite--run-import-tests)
38 (icalendar-testsuite--run-export-tests)
39 (icalendar-testsuite--run-cycle-tests)
40 (icalendar-testsuite--run-real-world-tests)
41 (message "All icalendar tests finished successfully."))
42
43 ;; ======================================================================
44 ;; Test methods for functions
45 ;; ======================================================================
46 (defun icalendar-testsuite--run-function-tests ()
47 "Perform tests for single icalendar functions."
48 (icalendar-testsuite--test-parse-summary-and-rest)
49 (icalendar-testsuite--test-format-ical-event)
50 (icalendar-testsuite--test-import-format-sample)
51 (icalendar-testsuite--test-first-weekday-of-year)
52 (icalendar-testsuite--test-datestring-to-isodate)
53 (icalendar-testsuite--test-datetime-to-diary-date)
54 (icalendar-testsuite--test-calendar-style)
55 (icalendar-testsuite--test-create-uid))
56
57 (defun icalendar-testsuite--test-format-ical-event ()
58 "Test `icalendar--format-ical-event'."
59 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
60 (icalendar-import-format-summary "SUM %s")
61 (icalendar-import-format-location " LOC %s")
62 (icalendar-import-format-description " DES %s")
63 (icalendar-import-format-organizer " ORG %s")
64 (icalendar-import-format-status " STA %s")
65 (icalendar-import-format-url " URL %s")
66 (icalendar-import-format-class " CLA %s")
67 (event (icalendar-testsuite--get-ical-event "BEGIN:VEVENT
68 DTSTAMP:20030509T043439Z
69 DTSTART:20030509T103000
70 SUMMARY:sum
71 ORGANIZER:org
72 LOCATION:loc
73 DTEND:20030509T153000
74 DESCRIPTION:des
75 END:VEVENT
76 ")))
77 (assert (string= (icalendar--format-ical-event event)
78 "SUM sum DES des LOC loc ORG org") t)
79 (setq icalendar-import-format (lambda (&rest ignore)
80 "helloworld"))
81 (assert (string= (icalendar--format-ical-event event)
82 "helloworld") t)
83 (setq icalendar-import-format
84 (lambda (e)
85 (format "-%s-%s-%s-%s-%s-%s-%s-"
86 (icalendar--get-event-property event 'SUMMARY)
87 (icalendar--get-event-property event 'DESCRIPTION)
88 (icalendar--get-event-property event 'LOCATION)
89 (icalendar--get-event-property event 'ORGANIZER)
90 (icalendar--get-event-property event 'STATUS)
91 (icalendar--get-event-property event 'URL)
92 (icalendar--get-event-property event 'CLASS))))
93 (assert (string= (icalendar--format-ical-event event)
94 "-sum-des-loc-org-nil-nil-nil-") t)))
95
96 (defun icalendar-testsuite--test-parse-summary-and-rest ()
97 "Test `icalendar--parse-summary-and-rest'."
98 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
99 (icalendar-import-format-summary "SUM %s")
100 (icalendar-import-format-location " LOC %s")
101 (icalendar-import-format-description " DES %s")
102 (icalendar-import-format-organizer " ORG %s")
103 (icalendar-import-format-status " STA %s")
104 (icalendar-import-format-url " URL %s")
105 (icalendar-import-format-class " CLA %s")
106 (result))
107 ;; FIXME: need a trailing blank char!
108 (setq result (icalendar--parse-summary-and-rest "SUM sum ORG org "))
109 (assert (string= (cdr (assoc 'org result)) "org"))
110
111 (setq result (icalendar--parse-summary-and-rest
112 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla "))
113 (assert (string= (cdr (assoc 'des result)) "des"))
114 (assert (string= (cdr (assoc 'loc result)) "loc"))
115 (assert (string= (cdr (assoc 'org result)) "org"))
116 (assert (string= (cdr (assoc 'sta result)) "sta"))
117 (assert (string= (cdr (assoc 'cla result)) "cla"))
118
119 (setq icalendar-import-format (lambda () "Hello world"))
120 (setq result (icalendar--parse-summary-and-rest
121 "blah blah "))
122 (assert (not result))
123 ))
124
125 (defun icalendar-testsuite--get-ical-event (ical-string)
126 "Helper function for testing `icalendar-testsuite--test-format-ical-event'.
127 Return icalendar event for ICAL-STRING."
128 (save-excursion
129 (with-temp-buffer
130 (insert ical-string)
131 (goto-char (point-min))
132 (car (icalendar--read-element nil nil)))))
133
134 (defun icalendar-testsuite--test-import-format-sample ()
135 "Test method for `icalendar-import-format-sample'."
136 (assert (string= (icalendar-import-format-sample
137 (icalendar-testsuite--get-ical-event "BEGIN:VEVENT
138 DTSTAMP:20030509T043439Z
139 DTSTART:20030509T103000
140 SUMMARY:a
141 ORGANIZER:d
142 LOCATION:c
143 DTEND:20030509T153000
144 DESCRIPTION:b
145 END:VEVENT
146 "))
147 (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
148 "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'"))))
149
150 (defun icalendar-testsuite--test-first-weekday-of-year ()
151 "Test method for `icalendar-first-weekday-of-year'."
152 (assert (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
153 (assert (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
154 (assert (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
155 (assert (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
156 (assert (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
157 (assert (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
158 (assert (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
159 (assert (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
160 (assert (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
161
162 (defun icalendar-testsuite--test-datestring-to-isodate ()
163 "Test method for `icalendar--datestring-to-isodate'."
164 (let ((calendar-date-style 'iso))
165 ;; numeric iso
166 (assert (string= (icalendar--datestring-to-isodate "2008 05 11")
167 "20080511"))
168 (assert (string= (icalendar--datestring-to-isodate "2008 05 31")
169 "20080531"))
170 (assert (string= (icalendar--datestring-to-isodate "2008 05 31" 2)
171 "20080602"))
172
173 ;; numeric european
174 (setq calendar-date-style 'european)
175 (assert (string= (icalendar--datestring-to-isodate "11 05 2008")
176 "20080511"))
177 (assert (string= (icalendar--datestring-to-isodate "31 05 2008")
178 "20080531"))
179 (assert (string= (icalendar--datestring-to-isodate "31 05 2008" 2)
180 "20080602"))
181
182 ;; numeric american
183 (setq calendar-date-style 'american)
184 (assert (string= (icalendar--datestring-to-isodate "11 05 2008")
185 "20081105"))
186 (assert (string= (icalendar--datestring-to-isodate "12 30 2008")
187 "20081230"))
188 (assert (string= (icalendar--datestring-to-isodate "12 30 2008" 2)
189 "20090101"))
190
191 ;; non-numeric
192 (setq calendar-date-style nil) ;not necessary for conversion
193 (assert (string= (icalendar--datestring-to-isodate "Nov 05 2008")
194 "20081105"))
195 (assert (string= (icalendar--datestring-to-isodate "05 Nov 2008")
196 "20081105"))
197 (assert (string= (icalendar--datestring-to-isodate "2008 Nov 05")
198 "20081105"))))
199
200 (defun icalendar-testsuite--test-datetime-to-diary-date ()
201 "Test method for `icalendar--datetime-to-diary-date'."
202 (let* ((datetime '(59 59 23 31 12 2008))
203 (calendar-date-style 'iso))
204 (assert (string= (icalendar--datetime-to-diary-date datetime)
205 "2008 12 31"))
206 (setq calendar-date-style 'european)
207 (assert (string= (icalendar--datetime-to-diary-date datetime)
208 "31 12 2008"))
209 (setq calendar-date-style 'american)
210 (assert (string= (icalendar--datetime-to-diary-date datetime)
211 "12 31 2008"))))
212
213 (defun icalendar-testsuite--test-calendar-style ()
214 "Test method for `icalendar--date-style'."
215 (dolist (calendar-date-style '(iso american european))
216 (assert (eq (icalendar--date-style) calendar-date-style)))
217 (let ((cds calendar-date-style)
218 (european-calendar-style t))
219 (makunbound 'calendar-date-style)
220 (assert (eq (icalendar--date-style) 'european))
221 (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME
222 (assert (eq (icalendar--date-style) 'american))
223 (setq calendar-date-style cds)))
224
225 (defun icalendar-testsuite--test-create-uid ()
226 "Test method for `icalendar--create-uid'."
227 (let (t-ct
228 (icalendar--uid-count 77))
229 ;; FIXME! If a test fails 'current-time is screwed. FIXME!
230 (fset 't-ct (symbol-function 'current-time))
231 (fset 'current-time (lambda () '(1 2 3)))
232 (assert (= 77 icalendar--uid-count))
233 (assert (string= "emacs12378" (icalendar--create-uid)))
234 (assert (= 78 icalendar--uid-count))
235 (fset 'current-time (symbol-function 't-ct))
236 ))
237
238 ;; ======================================================================
239 ;; Test methods for exporting from diary to icalendar
240 ;; ======================================================================
241
242 (defun icalendar-testsuite--test-export (input-iso input-european input-american
243 expected-output)
244 "Perform an export test.
245 Argument INPUT-ISO iso style diary string.
246 Argument INPUT-EUROPEAN european style diary string.
247 Argument INPUT-AMERICAN american style diary string.
248 Argument EXPECTED-OUTPUT expected icalendar result string.
249
250 European style input data must use german month names. American
251 and ISO style input data must use english month names."
252 (message "--- icalendar-testsuite--test-export ---")
253 (let ((calendar-date-style 'iso)
254 (icalendar-recurring-start-year 2000))
255 (set-time-zone-rule "CET") ;;FIXME: reset timezone!
256 (when input-iso
257 (let ((calendar-month-name-array
258 ["January" "February" "March" "April" "May" "June" "July" "August"
259 "September" "October" "November" "December"])
260 (calendar-day-name-array
261 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
262 "Saturday"]))
263 (setq calendar-date-style 'iso)
264 (icalendar-testsuite--do-test-export input-iso expected-output)))
265 (when input-european
266 (let ((calendar-month-name-array
267 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
268 "September" "Oktober" "November" "Dezember"])
269 (calendar-day-name-array
270 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
271 "Samstag"]))
272 (setq calendar-date-style 'european)
273 (icalendar-testsuite--do-test-export input-european expected-output)))
274 (when input-american
275 (let ((calendar-month-name-array
276 ["January" "February" "March" "April" "May" "June" "July" "August"
277 "September" "October" "November" "December"])
278 (calendar-day-name-array
279 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
280 "Saturday"]))
281 (setq calendar-date-style 'american)
282 (icalendar-testsuite--do-test-export input-american expected-output)))))
283
284 (defun icalendar-testsuite--do-test-export (input expected-output)
285 "Actually perform export test.
286 Argument INPUT input diary string.
287 Argument EXPECTED-OUTPUT expected icalendar result string."
288 (let ((temp-file (make-temp-file "icalendar-testsuite-ics")))
289 (with-temp-buffer
290 (insert input)
291 (icalendar-export-region (point-min) (point-max) temp-file))
292 (save-excursion
293 (find-file temp-file)
294 (goto-char (point-min))
295 (unless
296 (cond (expected-output
297 (and (re-search-forward "^\\s-*BEGIN:VCALENDAR
298 PRODID:-//Emacs//NONSGML icalendar.el//EN
299 VERSION:2.0
300 BEGIN:VEVENT
301 UID:emacs[0-9]+
302 \\(\\(.\\|\n\\)+\\)
303 END:VEVENT
304 END:VCALENDAR
305 \\s-*$"
306 nil t)
307 (string-match
308 (concat "^\\s-*"
309 (regexp-quote (buffer-substring-no-properties
310 (match-beginning 1) (match-end 1)))
311 "\\s-*$")
312 expected-output)))
313 (t
314 (re-search-forward "^\\s-*BEGIN:VCALENDAR
315 PRODID:-//Emacs//NONSGML icalendar.el//EN
316 VERSION:2.0
317 END:VCALENDAR
318 \\s-*$"
319 nil t)))
320 (error
321 "Export test failed! Input: `%s'\nFound:\n\n%s\n\nbut expected\n\n%s"
322 input
323 (or (and (match-beginning 1)
324 (buffer-substring-no-properties (match-beginning 1) (match-end 1)))
325 "<nil>")
326 (or expected-output "<nil>"))))
327 (kill-buffer (find-buffer-visiting temp-file))
328 (delete-file temp-file)))
329
330 ;; ======================================================================
331 ;; Test methods for importing from icalendar to diary
332 ;; ======================================================================
333
334 (defun icalendar-testsuite--test-import (input expected-iso expected-european
335 expected-american)
336 "Perform import test.
337 Argument INPUT icalendar event string.
338 Argument EXPECTED-ISO expected iso style diary string.
339 Argument EXPECTED-EUROPEAN expected european style diary string.
340 Argument EXPECTED-AMERICAN expected american style diary string."
341 (message "--- icalendar-testsuite--test-import ---")
342 (let ((timezone (cadr (current-time-zone))))
343 (set-time-zone-rule "CET")
344 (with-temp-buffer
345 (if (string-match "^BEGIN:VCALENDAR" input)
346 (insert input)
347 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
348 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
349 (insert input)
350 (unless (eq (char-before) ?\n)
351 (insert "\n"))
352 (insert "END:VEVENT\nEND:VCALENDAR\n"))
353 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
354 (icalendar-import-format-summary "%s")
355 (icalendar-import-format-location "\n Location: %s")
356 (icalendar-import-format-description "\n Desc: %s")
357 (icalendar-import-format-organizer "\n Organizer: %s")
358 (icalendar-import-format-status "\n Status: %s")
359 (icalendar-import-format-url "\n URL: %s")
360 (icalendar-import-format-class "\n Class: %s")
361 calendar-date-style)
362 (when expected-iso
363 (setq calendar-date-style 'iso)
364 (icalendar-testsuite--do-test-import input expected-iso))
365 (when expected-european
366 (setq calendar-date-style 'european)
367 (icalendar-testsuite--do-test-import input expected-european))
368 (when expected-american
369 (setq calendar-date-style 'american)
370 (icalendar-testsuite--do-test-import input expected-american))))
371 (set-time-zone-rule timezone)))
372
373 (defun icalendar-testsuite--do-test-import (input expected-output)
374 "Actually perform import test.
375 Argument INPUT input icalendar string.
376 Argument EXPECTED-OUTPUT expected diary string."
377 (let ((temp-file (make-temp-file "icalendar-test-diary")))
378 (icalendar-import-buffer temp-file t t)
379 (save-excursion
380 (find-file temp-file)
381 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
382 (unless (string-match (concat "^\\s-*" expected-output "\\s-*$")
383 result)
384 (error "Import test failed! Found `%s'\nbut expected `%s'" result
385 expected-output)))
386 (kill-buffer (find-buffer-visiting temp-file))
387 (delete-file temp-file))))
388
389 ;; ======================================================================
390 ;; Test methods for cycle...
391 ;; ======================================================================
392 (defun icalendar-testsuite--test-cycle (input)
393 "Perform cycle test.
394 Argument INPUT icalendar event string."
395 (with-temp-buffer
396 (if (string-match "^BEGIN:VCALENDAR" input)
397 (insert input)
398 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
399 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
400 (insert input)
401 (unless (eq (char-before) ?\n)
402 (insert "\n"))
403 (insert "END:VEVENT\nEND:VCALENDAR\n"))
404 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
405 (icalendar-import-format-summary "%s")
406 (icalendar-import-format-location "\n Location: %s")
407 (icalendar-import-format-description "\n Desc: %s")
408 (icalendar-import-format-organizer "\n Organizer: %s")
409 (icalendar-import-format-status "\n Status: %s")
410 (icalendar-import-format-url "\n URL: %s")
411 (icalendar-import-format-class "\n Class: %s"))
412 (dolist (calendar-date-style '(iso european american))
413 (icalendar-testsuite--do-test-cycle)))))
414
415 (defun icalendar-testsuite--do-test-cycle ()
416 "Actually perform import/export cycle test."
417 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
418 (temp-ics (make-temp-file "icalendar-test-ics"))
419 (org-input (buffer-substring-no-properties (point-min) (point-max))))
420 (icalendar-import-buffer temp-diary t t)
421 (save-excursion
422 (find-file temp-diary)
423 (icalendar-export-region (point-min) (point-max) temp-ics))
424 (save-excursion
425 (find-file temp-ics)
426 (goto-char (point-min))
427 (when (re-search-forward "\nUID:.*\n" nil t)
428 (replace-match "\n"))
429 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
430 (unless (string-equal org-input cycled)
431 (error "Import test failed! Found `%s'\nbut expected `%s'" cycled
432 org-input))))
433 (kill-buffer (find-buffer-visiting temp-diary))
434 (save-excursion
435 (set-buffer (find-buffer-visiting temp-ics))
436 (set-buffer-modified-p nil)
437 (kill-buffer (current-buffer)))
438 (delete-file temp-diary)
439 (delete-file temp-ics)))
440
441 ;; ======================================================================
442 ;; Import tests
443 ;; ======================================================================
444 (defun icalendar-testsuite--run-import-tests ()
445 "Perform standard import tests."
446 (icalendar-testsuite--test-import
447 "SUMMARY:non-recurring
448 DTSTART;VALUE=DATE-TIME:20030919T090000
449 DTEND;VALUE=DATE-TIME:20030919T113000"
450 "&2003/9/19 09:00-11:30 non-recurring"
451 "&19/9/2003 09:00-11:30 non-recurring"
452 "&9/19/2003 09:00-11:30 non-recurring")
453
454 (icalendar-testsuite--test-import
455 "SUMMARY:non-recurring allday
456 DTSTART;VALUE=DATE-TIME:20030919"
457 "&2003/9/19 non-recurring allday"
458 "&19/9/2003 non-recurring allday"
459 "&9/19/2003 non-recurring allday")
460
461 (icalendar-testsuite--test-import
462 "SUMMARY:long
463 summary
464 DTSTART;VALUE=DATE:20030919"
465 "&2003/9/19 long summary"
466 "&19/9/2003 long summary"
467 "&9/19/2003 long summary")
468
469 (icalendar-testsuite--test-import
470 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
471 SUMMARY:Sommerferien
472 STATUS:TENTATIVE
473 CLASS:PRIVATE
474 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
475 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
476 DTSTART;VALUE=DATE:20040719
477 DTEND;VALUE=DATE:20040828
478 DTSTAMP:20031103T011641Z
479 "
480 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien"
481 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien"
482 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien")
483
484 (icalendar-testsuite--test-import
485 "UID
486 :04979712-3902-11d9-93dd-8f9f4afe08da
487 SUMMARY
488 :folded summary
489 STATUS
490 :TENTATIVE
491 CLASS
492 :PRIVATE
493 X-MOZILLA-ALARM-DEFAULT-LENGTH
494 :0
495 DTSTART
496 :20041123T140000
497 DTEND
498 :20041123T143000
499 DTSTAMP
500 :20041118T013430Z
501 LAST-MODIFIED
502 :20041118T013640Z
503 "
504 "&2004/11/23 14:00-14:30 folded summary"
505 "&23/11/2004 14:00-14:30 folded summary"
506 "&11/23/2004 14:00-14:30 folded summary")
507 (icalendar-testsuite--test-import
508 "UID
509 :6161a312-3902-11d9-b512-f764153bb28b
510 SUMMARY
511 :another example
512 STATUS
513 :TENTATIVE
514 CLASS
515 :PRIVATE
516 X-MOZILLA-ALARM-DEFAULT-LENGTH
517 :0
518 DTSTART
519 :20041123T144500
520 DTEND
521 :20041123T154500
522 DTSTAMP
523 :20041118T013641Z
524 "
525 "&2004/11/23 14:45-15:45 another example"
526 "&23/11/2004 14:45-15:45 another example"
527 "&11/23/2004 14:45-15:45 another example")
528
529 (icalendar-testsuite--test-import
530 "SUMMARY:rrule daily
531 DTSTART;VALUE=DATE-TIME:20030919T090000
532 DTEND;VALUE=DATE-TIME:20030919T113000
533 RRULE:FREQ=DAILY;
534 "
535 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily"
536 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily"
537 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily")
538
539 ;; RRULE examples
540 (icalendar-testsuite--test-import
541 "SUMMARY:rrule daily
542 DTSTART;VALUE=DATE-TIME:20030919T090000
543 DTEND;VALUE=DATE-TIME:20030919T113000
544 RRULE:FREQ=DAILY;INTERVAL=2
545 "
546 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily"
547 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily"
548 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily")
549 (icalendar-testsuite--test-import
550 "SUMMARY:rrule daily with exceptions
551 DTSTART;VALUE=DATE-TIME:20030919T090000
552 DTEND;VALUE=DATE-TIME:20030919T113000
553 RRULE:FREQ=DAILY;INTERVAL=2
554 EXDATE:20030921,20030925
555 "
556 "&%%(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"
557 "&%%(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"
558 "&%%(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")
559
560 (icalendar-testsuite--test-import
561 "SUMMARY:rrule weekly
562 DTSTART;VALUE=DATE-TIME:20030919T090000
563 DTEND;VALUE=DATE-TIME:20030919T113000
564 RRULE:FREQ=WEEKLY;
565 "
566 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly"
567 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly"
568 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly")
569 (icalendar-testsuite--test-import
570 "SUMMARY:rrule monthly no end
571 DTSTART;VALUE=DATE-TIME:20030919T090000
572 DTEND;VALUE=DATE-TIME:20030919T113000
573 RRULE:FREQ=MONTHLY;
574 "
575 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end"
576 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end"
577 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end")
578 (icalendar-testsuite--test-import
579 "SUMMARY:rrule monthly with end
580 DTSTART;VALUE=DATE-TIME:20030919T090000
581 DTEND;VALUE=DATE-TIME:20030919T113000
582 RRULE:FREQ=MONTHLY;UNTIL=20050819;
583 "
584 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end"
585 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end"
586 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end")
587 (icalendar-testsuite--test-import
588 "DTSTART;VALUE=DATE:20040815
589 DTEND;VALUE=DATE:20040816
590 SUMMARY:Maria Himmelfahrt
591 UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
592 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
593 "
594 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt"
595 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt"
596 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt")
597 (icalendar-testsuite--test-import
598 "SUMMARY:rrule yearly
599 DTSTART;VALUE=DATE-TIME:20030919T090000
600 DTEND;VALUE=DATE-TIME:20030919T113000
601 RRULE:FREQ=YEARLY;INTERVAL=2
602 "
603 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly" ;FIXME
604 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly" ;FIXME
605 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly") ;FIXME
606 (icalendar-testsuite--test-import
607 "SUMMARY:rrule count daily short
608 DTSTART;VALUE=DATE-TIME:20030919T090000
609 DTEND;VALUE=DATE-TIME:20030919T113000
610 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
611 "
612 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short"
613 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short"
614 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short")
615 (icalendar-testsuite--test-import
616 "SUMMARY:rrule count daily long
617 DTSTART;VALUE=DATE-TIME:20030919T090000
618 DTEND;VALUE=DATE-TIME:20030919T113000
619 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
620 "
621 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long"
622 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long"
623 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long")
624 (icalendar-testsuite--test-import
625 "SUMMARY:rrule count bi-weekly 3 times
626 DTSTART;VALUE=DATE-TIME:20030919T090000
627 DTEND;VALUE=DATE-TIME:20030919T113000
628 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
629 "
630 "&%%(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"
631 "&%%(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"
632 "&%%(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")
633 (icalendar-testsuite--test-import
634 "SUMMARY:rrule count monthly
635 DTSTART;VALUE=DATE-TIME:20030919T090000
636 DTEND;VALUE=DATE-TIME:20030919T113000
637 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
638 "
639 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly"
640 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly"
641 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly")
642 (icalendar-testsuite--test-import
643 "SUMMARY:rrule count every second month
644 DTSTART;VALUE=DATE-TIME:20030919T090000
645 DTEND;VALUE=DATE-TIME:20030919T113000
646 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
647 "
648 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month" ;FIXME
649 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month" ;FIXME
650 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month") ;FIXME
651 (icalendar-testsuite--test-import
652 "SUMMARY:rrule count yearly
653 DTSTART;VALUE=DATE-TIME:20030919T090000
654 DTEND;VALUE=DATE-TIME:20030919T113000
655 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
656 "
657 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly"
658 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly"
659 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly")
660 (icalendar-testsuite--test-import
661 "SUMMARY:rrule count every second year
662 DTSTART;VALUE=DATE-TIME:20030919T090000
663 DTEND;VALUE=DATE-TIME:20030919T113000
664 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
665 "
666 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year" ;FIXME!!!
667 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year" ;FIXME!!!
668 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year") ;FIXME!!!
669
670 ;; duration
671 (icalendar-testsuite--test-import
672 "DTSTART;VALUE=DATE:20050217
673 SUMMARY:duration
674 DURATION:P7D
675 "
676 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration"
677 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration"
678 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration")
679
680 (icalendar-testsuite--test-import
681 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
682 DTSTAMP:20041127T183315Z
683 LAST-MODIFIED:20041127T183329
684 SUMMARY:Urlaub
685 DTSTART;VALUE=DATE:20011221
686 DTEND;VALUE=DATE:20011221
687 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
688 CLASS:PUBLIC
689 SEQUENCE:1
690 CREATED:20041127T183329
691 "
692 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub"
693 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub"
694 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub")
695 )
696
697 ;; ======================================================================
698 ;; Export tests
699 ;; ======================================================================
700 (defun icalendar-testsuite--run-export-tests ()
701 "Perform standard export tests."
702
703 (let ((icalendar-export-hidden-diary-entries nil))
704 (icalendar-testsuite--test-export
705 "&2000 Oct 3 ordinary no time "
706 "&3 Okt 2000 ordinary no time "
707 "&Oct 3 2000 ordinary no time "
708 nil))
709
710 ;; "ordinary" events
711 (icalendar-testsuite--test-export
712 "2000 Oct 3 ordinary no time "
713 "3 Okt 2000 ordinary no time "
714 "Oct 3 2000 ordinary no time "
715 "DTSTART;VALUE=DATE:20001003
716 DTEND;VALUE=DATE:20001004
717 SUMMARY:ordinary no time
718 ")
719 (icalendar-testsuite--test-export
720 "2000 Oct 3 16:30 ordinary with time"
721 "3 Okt 2000 16:30 ordinary with time"
722 "Oct 3 2000 16:30 ordinary with time"
723 "DTSTART;VALUE=DATE-TIME:20001003T163000
724 DTEND;VALUE=DATE-TIME:20001003T173000
725 SUMMARY:ordinary with time
726 ")
727 (icalendar-testsuite--test-export
728 "2000 10 3 16:30 ordinary with time 2"
729 "3 10 2000 16:30 ordinary with time 2"
730 "10 3 2000 16:30 ordinary with time 2"
731 "DTSTART;VALUE=DATE-TIME:20001003T163000
732 DTEND;VALUE=DATE-TIME:20001003T173000
733 SUMMARY:ordinary with time 2
734 ")
735
736 (icalendar-testsuite--test-export
737 "2000/10/3 16:30 ordinary with time 3"
738 "3/10/2000 16:30 ordinary with time 3"
739 "10/3/2000 16:30 ordinary with time 3"
740 "DTSTART;VALUE=DATE-TIME:20001003T163000
741 DTEND;VALUE=DATE-TIME:20001003T173000
742 SUMMARY:ordinary with time 3
743 ")
744
745 ;; multiline -- FIXME!!!
746 (icalendar-testsuite--test-export
747 "2000 October 3 16:30 multiline
748 17:30 multiline continued FIXME"
749 "3 Oktober 2000 16:30 multiline
750 17:30 multiline continued FIXME"
751 "October 3 2000 16:30 multiline
752 17:30 multiline continued FIXME"
753 "DTSTART;VALUE=DATE-TIME:20001003T163000
754 DTEND;VALUE=DATE-TIME:20001003T173000
755 SUMMARY:multiline
756 DESCRIPTION:
757 17:30 multiline continued FIXME
758 ")
759
760 ;; weekly by day
761 (icalendar-testsuite--test-export
762 "Monday 1:30pm weekly by day with start time"
763 "Montag 13:30 weekly by day with start time"
764 "Monday 1:30pm weekly by day with start time"
765 "DTSTART;VALUE=DATE-TIME:20000103T133000
766 DTEND;VALUE=DATE-TIME:20000103T143000
767 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
768 SUMMARY:weekly by day with start time
769 ")
770
771 (icalendar-testsuite--test-export
772 "Monday 13:30-15:00 weekly by day with start and end time"
773 "Montag 13:30-15:00 weekly by day with start and end time"
774 "Monday 01:30pm-03:00pm weekly by day with start and end time"
775 "DTSTART;VALUE=DATE-TIME:20000103T133000
776 DTEND;VALUE=DATE-TIME:20000103T150000
777 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
778 SUMMARY:weekly by day with start and end time
779 ")
780
781 ;; yearly
782 (icalendar-testsuite--test-export
783 "may 1 yearly no time"
784 "1 Mai yearly no time"
785 "may 1 yearly no time"
786 "DTSTART;VALUE=DATE:19000501
787 DTEND;VALUE=DATE:19000502
788 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
789 SUMMARY:yearly no time
790 ")
791
792 ;; anniversaries
793 (icalendar-testsuite--test-export
794 "%%(diary-anniversary 1989 10 3) anniversary no time"
795 "%%(diary-anniversary 3 10 1989) anniversary no time"
796 "%%(diary-anniversary 10 3 1989) anniversary no time"
797 "DTSTART;VALUE=DATE:19891003
798 DTEND;VALUE=DATE:19891004
799 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
800 SUMMARY:anniversary no time
801 ")
802 (icalendar-testsuite--test-export
803 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
804 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
805 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
806 "DTSTART;VALUE=DATE-TIME:19891003T190000
807 DTEND;VALUE=DATE-TIME:19891004T200000
808 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
809 SUMMARY:anniversary with time
810 ")
811
812 ;; block
813 (icalendar-testsuite--test-export
814 "%%(diary-block 2001 6 18 2001 7 6) block no time"
815 "%%(diary-block 18 6 2001 6 7 2001) block no time"
816 "%%(diary-block 6 18 2001 7 6 2001) block no time"
817 "DTSTART;VALUE=DATE:20010618
818 DTEND;VALUE=DATE:20010707
819 SUMMARY:block no time
820 ")
821 (icalendar-testsuite--test-export
822 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
823 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
824 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
825 "DTSTART;VALUE=DATE-TIME:20010618T130000
826 DTEND;VALUE=DATE-TIME:20010618T170000
827 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
828 SUMMARY:block with time
829 ")
830 (icalendar-testsuite--test-export
831 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
832 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
833 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
834 "DTSTART;VALUE=DATE-TIME:20010618T130000
835 DTEND;VALUE=DATE-TIME:20010618T140000
836 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
837 SUMMARY:block no end time
838 ")
839 )
840
841 ;; ======================================================================
842 ;; Real world
843 ;; ======================================================================
844 (defun icalendar-testsuite--run-real-world-tests ()
845 "Perform real-world tests, as gathered from problem reports."
846 ;; 2003-05-29
847 (icalendar-testsuite--test-import
848 "BEGIN:VCALENDAR
849 METHOD:REQUEST
850 PRODID:Microsoft CDO for Microsoft Exchange
851 VERSION:2.0
852 BEGIN:VTIMEZONE
853 TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
854 X-MICROSOFT-CDO-TZID:23
855 BEGIN:STANDARD
856 DTSTART:16010101T000000
857 TZOFFSETFROM:+0530
858 TZOFFSETTO:+0530
859 END:STANDARD
860 BEGIN:DAYLIGHT
861 DTSTART:16010101T000000
862 TZOFFSETFROM:+0530
863 TZOFFSETTO:+0530
864 END:DAYLIGHT
865 END:VTIMEZONE
866 BEGIN:VEVENT
867 DTSTAMP:20030509T043439Z
868 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
869 SUMMARY:On-Site Interview
870 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
871 010000000DB823520692542408ED02D7023F9DFF9
872 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
873 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
874 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
875 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
876 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
877 zz\":MAILTO:zzzzzz@zzzzzzz.com
878 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
879 LOCATION:Cccc
880 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
881 DESCRIPTION:10:30am - Blah
882 SEQUENCE:0
883 PRIORITY:5
884 CLASS:
885 CREATED:20030509T043439Z
886 LAST-MODIFIED:20030509T043459Z
887 STATUS:CONFIRMED
888 TRANSP:OPAQUE
889 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
890 X-MICROSOFT-CDO-INSTTYPE:0
891 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
892 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
893 X-MICROSOFT-CDO-IMPORTANCE:1
894 X-MICROSOFT-CDO-OWNERAPPTID:126441427
895 BEGIN:VALARM
896 ACTION:DISPLAY
897 DESCRIPTION:REMINDER
898 TRIGGER;RELATED=START:-PT00H15M00S
899 END:VALARM
900 END:VEVENT
901 END:VCALENDAR"
902 nil
903 "&9/5/2003 10:30-15:30 On-Site Interview
904 Desc: 10:30am - Blah
905 Location: Cccc
906 Organizer: MAILTO:aaaaaaa@aaaaaaa.com"
907 "&5/9/2003 10:30-15:30 On-Site Interview
908 Desc: 10:30am - Blah
909 Location: Cccc
910 Organizer: MAILTO:aaaaaaa@aaaaaaa.com")
911
912 ;; 2003-06-18 a
913 (icalendar-testsuite--test-import
914 "DTSTAMP:20030618T195512Z
915 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
916 SUMMARY:Dress Rehearsal for XXXX-XXXX
917 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
918 0100000007C3A6D65EE726E40B7F3D69A23BD567E
919 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
920 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
921 ORGANIZER;CN=\"ABCD,TECHTRAINING
922 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
923 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
924 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
925 DESCRIPTION:753 Zeichen hier radiert
926 SEQUENCE:0
927 PRIORITY:5
928 CLASS:
929 CREATED:20030618T195518Z
930 LAST-MODIFIED:20030618T195527Z
931 STATUS:CONFIRMED
932 TRANSP:OPAQUE
933 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
934 X-MICROSOFT-CDO-INSTTYPE:0
935 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
936 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
937 X-MICROSOFT-CDO-IMPORTANCE:1
938 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
939 BEGIN:VALARM
940 ACTION:DISPLAY
941 DESCRIPTION:REMINDER
942 TRIGGER;RELATED=START:-PT00H15M00S
943 END:VALARM"
944 nil
945 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
946 Desc: 753 Zeichen hier radiert
947 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
948 Organizer: MAILTO:xxx@xxxxx.com"
949 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
950 Desc: 753 Zeichen hier radiert
951 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
952 Organizer: MAILTO:xxx@xxxxx.com")
953
954 ;; 2003-06-18 b -- uses timezone
955 (icalendar-testsuite--test-import
956 "BEGIN:VCALENDAR
957 METHOD:REQUEST
958 PRODID:Microsoft CDO for Microsoft Exchange
959 VERSION:2.0
960 BEGIN:VTIMEZONE
961 TZID:Mountain Time (US & Canada)
962 X-MICROSOFT-CDO-TZID:12
963 BEGIN:STANDARD
964 DTSTART:16010101T020000
965 TZOFFSETFROM:-0600
966 TZOFFSETTO:-0700
967 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
968 END:STANDARD
969 BEGIN:DAYLIGHT
970 DTSTART:16010101T020000
971 TZOFFSETFROM:-0700
972 TZOFFSETTO:-0600
973 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
974 END:DAYLIGHT
975 END:VTIMEZONE
976 BEGIN:VEVENT
977 DTSTAMP:20030618T230323Z
978 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
979 SUMMARY:Updated: Dress Rehearsal for ABC01-15
980 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
981 0100000007C3A6D65EE726E40B7F3D69A23BD567E
982 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
983 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
984 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
985 .com
986 ORGANIZER;CN=\"ABCD,TECHTRAINING
987 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
988 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
989 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
990 DESCRIPTION:Viele Zeichen standen hier früher
991 SEQUENCE:0
992 PRIORITY:5
993 CLASS:
994 CREATED:20030618T230326Z
995 LAST-MODIFIED:20030618T230335Z
996 STATUS:CONFIRMED
997 TRANSP:OPAQUE
998 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
999 X-MICROSOFT-CDO-INSTTYPE:0
1000 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1001 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1002 X-MICROSOFT-CDO-IMPORTANCE:1
1003 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1004 BEGIN:VALARM
1005 ACTION:DISPLAY
1006 DESCRIPTION:REMINDER
1007 TRIGGER;RELATED=START:-PT00H15M00S
1008 END:VALARM
1009 END:VEVENT
1010 END:VCALENDAR"
1011 nil
1012 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1013 Desc: Viele Zeichen standen hier früher
1014 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1015 Organizer: MAILTO:bbb@bbbbb.com
1016 Status: CONFIRMED"
1017 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1018 Desc: Viele Zeichen standen hier früher
1019 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1020 Organizer: MAILTO:bbb@bbbbb.com
1021 Status: CONFIRMED")
1022
1023 ;; export 2004-10-28 block entries
1024 (icalendar-testsuite--test-export
1025 nil
1026 nil
1027 "-*- mode: text; fill-column: 256;-*-
1028
1029 >>> block entries:
1030
1031 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1032 "
1033 "DTSTART;VALUE=DATE:20041108
1034 DTEND;VALUE=DATE:20041111
1035 SUMMARY:Nov 8-10 aa")
1036
1037 (icalendar-testsuite--test-export
1038 nil
1039 nil
1040 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1041 "DTSTART;VALUE=DATE:20041213
1042 DTEND;VALUE=DATE:20041218
1043 SUMMARY:Dec 13-17 bb")
1044
1045 (icalendar-testsuite--test-export
1046 nil
1047 nil
1048 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1049 "DTSTART;VALUE=DATE:20050203
1050 DTEND;VALUE=DATE:20050205
1051 SUMMARY:Feb 3-4 cc")
1052
1053 (icalendar-testsuite--test-export
1054 nil
1055 nil
1056 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1057 "DTSTART;VALUE=DATE:20050424
1058 DTEND;VALUE=DATE:20050430
1059 SUMMARY:April 24-29 dd
1060 ")
1061 (icalendar-testsuite--test-export
1062 nil
1063 nil
1064 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1065 "DTSTART;VALUE=DATE:20050530
1066 DTEND;VALUE=DATE:20050602
1067 SUMMARY:may 30 - June 1: ee")
1068
1069 (icalendar-testsuite--test-export
1070 nil
1071 nil
1072 "%%(diary-block 6 6 2005 6 8 2005) ff"
1073 "DTSTART;VALUE=DATE:20050606
1074 DTEND;VALUE=DATE:20050609
1075 SUMMARY:ff")
1076
1077 ;; export 2004-10-28 anniversary entries
1078 (icalendar-testsuite--test-export
1079 nil
1080 nil
1081 "
1082 >>> anniversaries:
1083
1084 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1085 "DTSTART;VALUE=DATE:19910328
1086 DTEND;VALUE=DATE:19910329
1087 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1088 SUMMARY:aa birthday (%d years old)
1089 ")
1090
1091 (icalendar-testsuite--test-export
1092 nil
1093 nil
1094 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1095 "DTSTART;VALUE=DATE:19570517
1096 DTEND;VALUE=DATE:19570518
1097 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1098 SUMMARY:bb birthday (%d years old)")
1099
1100 (icalendar-testsuite--test-export
1101 nil
1102 nil
1103 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1104 "DTSTART;VALUE=DATE:19970608
1105 DTEND;VALUE=DATE:19970609
1106 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1107 SUMMARY:cc birthday (%d years old)")
1108
1109 (icalendar-testsuite--test-export
1110 nil
1111 nil
1112 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1113 "DTSTART;VALUE=DATE:19830722
1114 DTEND;VALUE=DATE:19830723
1115 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1116 SUMMARY:dd (%d years ago...!)")
1117
1118 (icalendar-testsuite--test-export
1119 nil
1120 nil
1121 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1122 "DTSTART;VALUE=DATE:19880801
1123 DTEND;VALUE=DATE:19880802
1124 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1125 SUMMARY:ee birthday (%d years old)")
1126
1127 (icalendar-testsuite--test-export
1128 nil
1129 nil
1130 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1131 "DTSTART;VALUE=DATE:19570921
1132 DTEND;VALUE=DATE:19570922
1133 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1134 SUMMARY:ff birthday (%d years old)")
1135
1136
1137 ;; FIXME!
1138
1139 ;; export 2004-10-28 monthly, weekly entries
1140
1141 ;; (icalendar-testsuite--test-export
1142 ;; nil
1143 ;; "
1144 ;; >>> ------------ monthly:
1145
1146 ;; */27/* 10:00 blah blah"
1147 ;; "xxx")
1148
1149 (icalendar-testsuite--test-export
1150 nil
1151 nil
1152 ">>> ------------ my week:
1153
1154 Monday 13:00 MAC"
1155 "DTSTART;VALUE=DATE-TIME:20000103T130000
1156 DTEND;VALUE=DATE-TIME:20000103T140000
1157 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1158 SUMMARY:MAC")
1159
1160 (icalendar-testsuite--test-export
1161 nil
1162 nil
1163 "Monday 15:00 a1"
1164 "DTSTART;VALUE=DATE-TIME:20000103T150000
1165 DTEND;VALUE=DATE-TIME:20000103T160000
1166 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1167 SUMMARY:a1")
1168
1169
1170 (icalendar-testsuite--test-export
1171 nil
1172 nil
1173 "Monday 16:00-17:00 a2"
1174 "DTSTART;VALUE=DATE-TIME:20000103T160000
1175 DTEND;VALUE=DATE-TIME:20000103T170000
1176 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1177 SUMMARY:a2")
1178
1179 (icalendar-testsuite--test-export
1180 nil
1181 nil
1182 "Tuesday 11:30-13:00 a3"
1183 "DTSTART;VALUE=DATE-TIME:20000104T113000
1184 DTEND;VALUE=DATE-TIME:20000104T130000
1185 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1186 SUMMARY:a3")
1187
1188 (icalendar-testsuite--test-export
1189 nil
1190 nil
1191 "Tuesday 15:00 a4"
1192 "DTSTART;VALUE=DATE-TIME:20000104T150000
1193 DTEND;VALUE=DATE-TIME:20000104T160000
1194 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1195 SUMMARY:a4")
1196
1197 (icalendar-testsuite--test-export
1198 nil
1199 nil
1200 "Wednesday 13:00 a5"
1201 "DTSTART;VALUE=DATE-TIME:20000105T130000
1202 DTEND;VALUE=DATE-TIME:20000105T140000
1203 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1204 SUMMARY:a5")
1205
1206 (icalendar-testsuite--test-export
1207 nil
1208 nil
1209 "Wednesday 11:30-13:30 a6"
1210 "DTSTART;VALUE=DATE-TIME:20000105T113000
1211 DTEND;VALUE=DATE-TIME:20000105T133000
1212 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1213 SUMMARY:a6")
1214
1215 (icalendar-testsuite--test-export
1216 nil
1217 nil
1218 "Wednesday 15:00 s1"
1219 "DTSTART;VALUE=DATE-TIME:20000105T150000
1220 DTEND;VALUE=DATE-TIME:20000105T160000
1221 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1222 SUMMARY:s1")
1223
1224
1225 ;; export 2004-10-28 regular entries
1226 (icalendar-testsuite--test-export
1227 nil
1228 nil
1229 "
1230 >>> regular diary entries:
1231
1232 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1233 "DTSTART;VALUE=DATE-TIME:20041012T140000
1234 DTEND;VALUE=DATE-TIME:20041012T150000
1235 SUMMARY:Tue: [2004-10-12] q1")
1236
1237 ;; 2004-11-19
1238 (icalendar-testsuite--test-import
1239 "BEGIN:VCALENDAR
1240 VERSION
1241 :2.0
1242 PRODID
1243 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1244 BEGIN:VEVENT
1245 UID
1246 :04979712-3902-11d9-93dd-8f9f4afe08da
1247 SUMMARY
1248 :Jjjjj & Wwwww
1249 STATUS
1250 :TENTATIVE
1251 CLASS
1252 :PRIVATE
1253 X-MOZILLA-ALARM-DEFAULT-LENGTH
1254 :0
1255 DTSTART
1256 :20041123T140000
1257 DTEND
1258 :20041123T143000
1259 DTSTAMP
1260 :20041118T013430Z
1261 LAST-MODIFIED
1262 :20041118T013640Z
1263 END:VEVENT
1264 BEGIN:VEVENT
1265 UID
1266 :6161a312-3902-11d9-b512-f764153bb28b
1267 SUMMARY
1268 :BB Aaaaaaaa Bbbbb
1269 STATUS
1270 :TENTATIVE
1271 CLASS
1272 :PRIVATE
1273 X-MOZILLA-ALARM-DEFAULT-LENGTH
1274 :0
1275 DTSTART
1276 :20041123T144500
1277 DTEND
1278 :20041123T154500
1279 DTSTAMP
1280 :20041118T013641Z
1281 END:VEVENT
1282 BEGIN:VEVENT
1283 UID
1284 :943a4d7e-3902-11d9-9ce7-c9addeadf928
1285 SUMMARY
1286 :Hhhhhhhh
1287 STATUS
1288 :TENTATIVE
1289 CLASS
1290 :PRIVATE
1291 X-MOZILLA-ALARM-DEFAULT-LENGTH
1292 :0
1293 DTSTART
1294 :20041123T110000
1295 DTEND
1296 :20041123T120000
1297 DTSTAMP
1298 :20041118T013831Z
1299 END:VEVENT
1300 BEGIN:VEVENT
1301 UID
1302 :fe53615e-3902-11d9-9dd8-9d38a155bf41
1303 SUMMARY
1304 :MMM Aaaaaaaaa
1305 STATUS
1306 :TENTATIVE
1307 CLASS
1308 :PRIVATE
1309 X-MOZILLA-ALARM-DEFAULT-LENGTH
1310 :0
1311 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1312 :2
1313 RRULE
1314 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1315 DTSTART
1316 :20041112T140000
1317 DTEND
1318 :20041112T183000
1319 DTSTAMP
1320 :20041118T014117Z
1321 END:VEVENT
1322 BEGIN:VEVENT
1323 UID
1324 :87c928ee-3901-11d9-b21f-b45042155024
1325 SUMMARY
1326 :Rrrr/Cccccc ii Aaaaaaaa
1327 DESCRIPTION
1328 :Vvvvv Rrrr aaa Cccccc
1329 STATUS
1330 :TENTATIVE
1331 CLASS
1332 :PRIVATE
1333 X-MOZILLA-ALARM-DEFAULT-LENGTH
1334 :0
1335 DTSTART
1336 ;VALUE=DATE
1337 :20041119
1338 DTEND
1339 ;VALUE=DATE
1340 :20041120
1341 DTSTAMP
1342 :20041118T013107Z
1343 LAST-MODIFIED
1344 :20041118T014203Z
1345 END:VEVENT
1346 BEGIN:VEVENT
1347 UID
1348 :e8f331ae-3902-11d9-9948-dfdcb66a2872
1349 SUMMARY
1350 :Wwww aa hhhh
1351 STATUS
1352 :TENTATIVE
1353 CLASS
1354 :PRIVATE
1355 X-MOZILLA-ALARM-DEFAULT-LENGTH
1356 :0
1357 RRULE
1358 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1359 DTSTART
1360 ;VALUE=DATE
1361 :20041101
1362 DTEND
1363 ;VALUE=DATE
1364 :20041102
1365 DTSTAMP
1366 :20041118T014045Z
1367 LAST-MODIFIED
1368 :20041118T023846Z
1369 END:VEVENT
1370 END:VCALENDAR
1371 "
1372 nil
1373 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
1374 Status: TENTATIVE
1375 Class: PRIVATE
1376 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1377 Status: TENTATIVE
1378 Class: PRIVATE
1379 &23/11/2004 11:00-12:00 Hhhhhhhh
1380 Status: TENTATIVE
1381 Class: PRIVATE
1382 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
1383 Status: TENTATIVE
1384 Class: PRIVATE
1385 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
1386 Desc: Vvvvv Rrrr aaa Cccccc
1387 Status: TENTATIVE
1388 Class: PRIVATE
1389 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
1390 Status: TENTATIVE
1391 Class: PRIVATE "
1392 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
1393 Status: TENTATIVE
1394 Class: PRIVATE
1395 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1396 Status: TENTATIVE
1397 Class: PRIVATE
1398 &11/23/2004 11:00-12:00 Hhhhhhhh
1399 Status: TENTATIVE
1400 Class: PRIVATE
1401 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
1402 Status: TENTATIVE
1403 Class: PRIVATE
1404 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
1405 Desc: Vvvvv Rrrr aaa Cccccc
1406 Status: TENTATIVE
1407 Class: PRIVATE
1408 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
1409 Status: TENTATIVE
1410 Class: PRIVATE ")
1411
1412 ;; 2004-09-09 pg
1413 (icalendar-testsuite--test-export
1414 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
1415 nil
1416 nil
1417 "DTSTART;VALUE=DATE:20040101
1418 DTEND;VALUE=DATE:20040105
1419 SUMMARY:Urlaub")
1420
1421 ;; 2004-10-25 pg
1422 (icalendar-testsuite--test-export
1423 nil
1424 "5 11 2004 Bla Fasel"
1425 nil
1426 "DTSTART;VALUE=DATE:20041105
1427 DTEND;VALUE=DATE:20041106
1428 SUMMARY:Bla Fasel")
1429
1430 ;; 2004-10-30 pg
1431 (icalendar-testsuite--test-export
1432 nil
1433 "2 Nov 2004 15:00-16:30 Zahnarzt"
1434 nil
1435 "DTSTART;VALUE=DATE-TIME:20041102T150000
1436 DTEND;VALUE=DATE-TIME:20041102T163000
1437 SUMMARY:Zahnarzt")
1438
1439 ;; 2005-02-07 lt
1440 (icalendar-testsuite--test-import
1441 "UID
1442 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
1443 SUMMARY
1444 :Waitangi Day
1445 DESCRIPTION
1446 :abcdef
1447 CATEGORIES
1448 :Public Holiday
1449 STATUS
1450 :CONFIRMED
1451 CLASS
1452 :PRIVATE
1453 DTSTART
1454 ;VALUE=DATE
1455 :20050206
1456 DTEND
1457 ;VALUE=DATE
1458 :20050207
1459 DTSTAMP
1460 :20050128T011209Z"
1461 nil
1462 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
1463 Desc: abcdef"
1464 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
1465 Desc: abcdef")
1466
1467 ;; 2005-03-01 lt
1468 (icalendar-testsuite--test-import
1469 "DTSTART;VALUE=DATE:20050217
1470 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
1471 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
1472 DTSTAMP:20050118T210335Z
1473 DURATION:P7D"
1474 nil
1475 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa"
1476 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa")
1477
1478 ;; 2005-03-23 lt
1479 (icalendar-testsuite--test-export
1480 nil
1481 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
1482 nil
1483 "DTSTART;VALUE=DATE-TIME:20050208T160000
1484 DTEND;VALUE=DATE-TIME:20050208T164500
1485 RRULE:FREQ=DAILY;INTERVAL=7
1486 SUMMARY:[WORK] Pppp
1487 ")
1488
1489 ;; 2005-05-27 eu
1490 (icalendar-testsuite--test-export
1491 nil
1492 nil
1493 ;; FIXME: colon not allowed!
1494 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
1495 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
1496 "DTSTART;VALUE=DATE:19001101
1497 DTEND;VALUE=DATE:19001102
1498 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
1499 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
1500 ")
1501 )
1502
1503 (defun icalendar-testsuite--run-cycle-tests ()
1504 "Perform cycling tests."
1505 (icalendar-testsuite--test-cycle
1506 "DTSTART;VALUE=DATE-TIME:20030919T090000
1507 DTEND;VALUE=DATE-TIME:20030919T113000
1508 SUMMARY:Cycletest
1509 ")
1510
1511 (icalendar-testsuite--test-cycle
1512 "DTSTART;VALUE=DATE-TIME:20030919T090000
1513 DTEND;VALUE=DATE-TIME:20030919T113000
1514 SUMMARY:Cycletest
1515 DESCRIPTION:beschreibung!
1516 LOCATION:nowhere
1517 ORGANIZER:ulf
1518 ")
1519
1520 ;; FIXME: does not work
1521 ;; (icalendar-testsuite--test-cycle
1522 ;; "DTSTART;VALUE=DATE:19190909
1523 ;;DTEND;VALUE=DATE:19190910
1524 ;;RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1525 ;;SUMMARY:and diary-anniversary
1526 ;;")
1527 )
1528
1529
1530 (provide 'icalendar-testsuite)
1531
1532 ;; arch-tag: 33a98396-90e9-49c8-b0e9-b606386d6e8c
1533 ;;; icalendar-testsuite.el ends here