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>
8 ;; Human-Keywords: calendar, diary, iCalendar, vCalendar
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; - Add more unit tests for functions, timezone etc.
30 ;; Note: Watch the trailing blank that is added on import.
33 (defun icalendar-testsuite-run ()
34 "Run icalendar test suite."
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."))
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-diarytime-to-isotime)
55 (icalendar-testsuite--test-convert-ordinary-to-ical)
56 (icalendar-testsuite--test-convert-weekly-to-ical)
57 (icalendar-testsuite--test-convert-yearly-to-ical)
58 (icalendar-testsuite--test-convert-block-to-ical)
59 (icalendar-testsuite--test-convert-cyclic-to-ical)
60 (icalendar-testsuite--test-convert-anniversary-to-ical)
61 (icalendar-testsuite--test-calendar-style)
62 (icalendar-testsuite--test-create-uid)
63 (icalendar-testsuite--test-parse-vtimezone))
65 (defun icalendar-testsuite--test-format-ical-event ()
66 "Test `icalendar--format-ical-event'."
67 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
68 (icalendar-import-format-summary "SUM %s")
69 (icalendar-import-format-location " LOC %s")
70 (icalendar-import-format-description " DES %s")
71 (icalendar-import-format-organizer " ORG %s")
72 (icalendar-import-format-status " STA %s")
73 (icalendar-import-format-url " URL %s")
74 (icalendar-import-format-class " CLA %s")
75 (event (icalendar-testsuite--get-ical-event "BEGIN:VEVENT
76 DTSTAMP:20030509T043439Z
77 DTSTART:20030509T103000
85 (assert (string= (icalendar--format-ical-event event
)
86 "SUM sum DES des LOC loc ORG org") t
)
87 (setq icalendar-import-format
(lambda (&rest ignore
)
89 (assert (string= (icalendar--format-ical-event event
)
91 (setq icalendar-import-format
93 (format "-%s-%s-%s-%s-%s-%s-%s-"
94 (icalendar--get-event-property event
'SUMMARY
)
95 (icalendar--get-event-property event
'DESCRIPTION
)
96 (icalendar--get-event-property event
'LOCATION
)
97 (icalendar--get-event-property event
'ORGANIZER
)
98 (icalendar--get-event-property event
'STATUS
)
99 (icalendar--get-event-property event
'URL
)
100 (icalendar--get-event-property event
'CLASS
))))
101 (assert (string= (icalendar--format-ical-event event
)
102 "-sum-des-loc-org-nil-nil-nil-") t
)))
104 (defun icalendar-testsuite--test-parse-summary-and-rest ()
105 "Test `icalendar--parse-summary-and-rest'."
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")
115 (setq result
(icalendar--parse-summary-and-rest "SUM sum ORG org"))
116 (assert (string= (cdr (assoc 'org result
)) "org"))
118 (setq result
(icalendar--parse-summary-and-rest
119 "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
120 (assert (string= (cdr (assoc 'des result
)) "des"))
121 (assert (string= (cdr (assoc 'loc result
)) "loc"))
122 (assert (string= (cdr (assoc 'org result
)) "org"))
123 (assert (string= (cdr (assoc 'sta result
)) "sta"))
124 (assert (string= (cdr (assoc 'cla result
)) "cla"))
126 (setq icalendar-import-format
(lambda () "Hello world"))
127 (setq result
(icalendar--parse-summary-and-rest
129 (assert (not result
))
132 (defun icalendar-testsuite--get-ical-event (ical-string)
133 "Helper function for testing `icalendar-testsuite--test-format-ical-event'.
134 Return icalendar event for ICAL-STRING."
138 (goto-char (point-min))
139 (car (icalendar--read-element nil nil
)))))
141 (defun icalendar-testsuite--test-import-format-sample ()
142 "Test method for `icalendar-import-format-sample'."
143 (assert (string= (icalendar-import-format-sample
144 (icalendar-testsuite--get-ical-event "BEGIN:VEVENT
145 DTSTAMP:20030509T043439Z
146 DTSTART:20030509T103000
150 DTEND:20030509T153000
154 (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
155 "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'"))))
157 (defun icalendar-testsuite--test-first-weekday-of-year ()
158 "Test method for `icalendar-first-weekday-of-year'."
159 (assert (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
160 (assert (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
161 (assert (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
162 (assert (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
163 (assert (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
164 (assert (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
165 (assert (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
166 (assert (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
167 (assert (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
169 (defun icalendar-testsuite--test-datestring-to-isodate ()
170 "Test method for `icalendar--datestring-to-isodate'."
171 (let ((calendar-date-style 'iso
))
173 (assert (string= (icalendar--datestring-to-isodate "2008 05 11")
175 (assert (string= (icalendar--datestring-to-isodate "2008 05 31")
177 (assert (string= (icalendar--datestring-to-isodate "2008 05 31" 2)
181 (setq calendar-date-style
'european
)
182 (assert (string= (icalendar--datestring-to-isodate "11 05 2008")
184 (assert (string= (icalendar--datestring-to-isodate "31 05 2008")
186 (assert (string= (icalendar--datestring-to-isodate "31 05 2008" 2)
190 (setq calendar-date-style
'american
)
191 (assert (string= (icalendar--datestring-to-isodate "11 05 2008")
193 (assert (string= (icalendar--datestring-to-isodate "12 30 2008")
195 (assert (string= (icalendar--datestring-to-isodate "12 30 2008" 2)
199 (setq calendar-date-style nil
) ;not necessary for conversion
200 (assert (string= (icalendar--datestring-to-isodate "Nov 05 2008")
202 (assert (string= (icalendar--datestring-to-isodate "05 Nov 2008")
204 (assert (string= (icalendar--datestring-to-isodate "2008 Nov 05")
207 (defun icalendar-testsuite--test-datetime-to-diary-date ()
208 "Test method for `icalendar--datetime-to-diary-date'."
209 (let* ((datetime '(59 59 23 31 12 2008))
210 (calendar-date-style 'iso
))
211 (assert (string= (icalendar--datetime-to-diary-date datetime
)
213 (setq calendar-date-style
'european
)
214 (assert (string= (icalendar--datetime-to-diary-date datetime
)
216 (setq calendar-date-style
'american
)
217 (assert (string= (icalendar--datetime-to-diary-date datetime
)
220 (defun icalendar-testsuite--test-diarytime-to-isotime ()
221 "Test method for `icalendar--diarytime-to-isotime'."
222 (assert (string= (icalendar--diarytime-to-isotime "01:15" "")
224 (assert (string= (icalendar--diarytime-to-isotime "1:15" "")
226 (assert (string= (icalendar--diarytime-to-isotime "0:01" "")
228 (assert (string= (icalendar--diarytime-to-isotime "0100" "")
230 (assert (string= (icalendar--diarytime-to-isotime "0100" "am")
232 (assert (string= (icalendar--diarytime-to-isotime "0100" "pm")
234 (assert (string= (icalendar--diarytime-to-isotime "1200" "")
236 (assert (string= (icalendar--diarytime-to-isotime "17:17" "")
238 (assert (string= (icalendar--diarytime-to-isotime "1200" "am")
240 (assert (string= (icalendar--diarytime-to-isotime "1201" "am")
242 (assert (string= (icalendar--diarytime-to-isotime "1259" "am")
244 (assert (string= (icalendar--diarytime-to-isotime "1200" "pm")
246 (assert (string= (icalendar--diarytime-to-isotime "1201" "pm")
248 (assert (string= (icalendar--diarytime-to-isotime "1259" "pm")
251 (defun icalendar-testsuite--test-convert-ordinary-to-ical ()
252 "Test method for `icalendar--convert-ordinary-to-ical'."
253 (let* ((calendar-date-style 'iso
)
256 (setq result
(icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
257 (assert (= 2 (length result
)))
258 (assert (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
260 (assert (string= "subject" (cadr result
)))
263 (setq result
(icalendar--convert-ordinary-to-ical
264 "&?" "&2010 2 15 12:34-23:45 s"))
265 (assert (= 2 (length result
)))
266 (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
267 "\nDTEND;VALUE=DATE-TIME:20100215T234500")
269 (assert (string= "s" (cadr result
)))
271 ;; with time, again -- test bug#5549
272 (setq result
(icalendar--convert-ordinary-to-ical
273 "x?" "x2010 2 15 0:34-1:45 s"))
274 (assert (= 2 (length result
)))
275 (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
276 "\nDTEND;VALUE=DATE-TIME:20100215T014500")
278 (assert (string= "s" (cadr result
)))))
280 (defun icalendar-testsuite--test-convert-weekly-to-ical ()
281 "Test method for `icalendar--convert-weekly-to-ical'."
282 (let* ((calendar-date-style 'iso
)
284 (calendar-day-name-array
285 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
287 (setq result
(icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
288 (assert (= 2 (length result
)))
289 (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
290 "\nDTEND;VALUE=DATE-TIME:20050103T093000"
291 "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
293 (assert (string= "subject" (cadr result
)))))
295 (defun icalendar-testsuite--test-convert-yearly-to-ical ()
296 "Test method for `icalendar--convert-yearly-to-ical'."
297 (let* ((calendar-date-style 'iso
)
299 (calendar-month-name-array
300 ["January" "February" "March" "April" "May" "June" "July" "August"
301 "September" "October" "November" "December"]))
302 (setq result
(icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
303 (assert (= 2 (length result
)))
304 (assert (string= (concat
305 "\nDTSTART;VALUE=DATE:19000501"
306 "\nDTEND;VALUE=DATE:19000502"
307 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
309 (assert (string= "Tag der Arbeit" (cadr result
)))))
311 (defun icalendar-testsuite--test-convert-block-to-ical ()
312 "Test method for `icalendar--convert-block-to-ical'."
313 (let* ((calendar-date-style 'iso
)
315 (setq result
(icalendar--convert-block-to-ical
316 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
317 (assert (= 2 (length result
)))
318 (assert (string= (concat
319 "\nDTSTART;VALUE=DATE:20040719"
320 "\nDTEND;VALUE=DATE:20040828")
322 (assert (string= "Sommerferien" (cadr result
)))))
324 (defun icalendar-testsuite--test-convert-cyclic-to-ical ()
325 "Test method for `icalendar--convert-cyclic-to-ical'."
326 (let* ((calendar-date-style 'iso
)
328 (setq result
(icalendar--convert-block-to-ical
329 "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
330 (assert (= 2 (length result
)))
331 (assert (string= (concat
332 "\nDTSTART;VALUE=DATE:20040719"
333 "\nDTEND;VALUE=DATE:20040828")
335 (assert (string= "Sommerferien" (cadr result
)))))
337 (defun icalendar-testsuite--test-convert-anniversary-to-ical ()
338 "Test method for `icalendar--convert-anniversary-to-ical'."
339 (let* ((calendar-date-style 'iso
)
341 (setq result
(icalendar--convert-anniversary-to-ical
342 "" "%%(diary-anniversary 1964 6 30) g"))
343 (assert (= 2 (length result
)))
344 (assert (string= (concat
345 "\nDTSTART;VALUE=DATE:19640630"
346 "\nDTEND;VALUE=DATE:19640701"
347 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
349 (assert (string= "g" (cadr result
)))))
351 (defun icalendar-testsuite--test-calendar-style ()
352 "Test method for `icalendar--date-style'."
353 (dolist (calendar-date-style '(iso american european
))
354 (assert (eq (icalendar--date-style) calendar-date-style
)))
355 (let ((cds calendar-date-style
)
356 (european-calendar-style t
))
357 (makunbound 'calendar-date-style
)
358 (assert (eq (icalendar--date-style) 'european
))
359 (with-no-warnings (setq european-calendar-style nil
)) ;still get warning!?! FIXME
360 (assert (eq (icalendar--date-style) 'american
))
361 (setq calendar-date-style cds
)))
363 (defun icalendar-testsuite--test-create-uid ()
364 "Test method for `icalendar--create-uid'."
365 (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s")
367 (icalendar--uid-count 77)
368 (entry-full "30.06.1964 07:01 blahblah")
369 (hash (format "%d" (abs (sxhash entry-full
))))
370 (contents "DTSTART:19640630T070100\nblahblah")
371 (username (or user-login-name
"UNKNOWN_USER"))
373 ;; FIXME! If a test fails 'current-time is screwed. FIXME!
374 (fset 't-ct
(symbol-function 'current-time
))
375 (fset 'current-time
(lambda () '(1 2 3)))
376 (assert (= 77 icalendar--uid-count
))
377 (assert (string= (concat "xxx-123-77-" hash
"-" username
"-19640630")
378 (icalendar--create-uid entry-full contents
)))
379 (assert (= 78 icalendar--uid-count
))
380 (fset 'current-time
(symbol-function 't-ct
))
382 (setq contents
"blahblah")
383 (setq icalendar-uid-format
"yyy%syyy")
384 (assert (string= (concat "yyyDTSTARTyyy")
385 (icalendar--create-uid entry-full contents
)))
388 (defun icalendar-testsuite--test-parse-vtimezone ()
389 (let (vtimezone result
)
390 (setq vtimezone
(icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE
393 DTSTART:16010101T040000
396 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
399 DTSTART:16010101T030000
402 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
406 (setq result
(icalendar--parse-vtimezone vtimezone
))
407 (assert (string= "thename" (car result
)))
408 (message (cdr result
))
409 (assert (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" (cdr result
)))
410 (setq vtimezone
(icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE
413 DTSTART:16010101T040000
416 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
419 DTSTART:16010101T030000
422 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
426 (setq result
(icalendar--parse-vtimezone vtimezone
))
427 (assert (string= "anothername" (car result
)))
428 (message (cdr result
))
429 (assert (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" (cdr result
)))))
431 ;; ======================================================================
432 ;; Test methods for exporting from diary to icalendar
433 ;; ======================================================================
435 (defun icalendar-testsuite--test-export (input-iso input-european input-american
437 "Perform an export test.
438 Argument INPUT-ISO iso style diary string.
439 Argument INPUT-EUROPEAN european style diary string.
440 Argument INPUT-AMERICAN american style diary string.
441 Argument EXPECTED-OUTPUT expected icalendar result string.
443 European style input data must use german month names. American
444 and ISO style input data must use english month names."
445 (message "--- icalendar-testsuite--test-export ---")
446 (let ((calendar-date-style 'iso
)
447 (icalendar-recurring-start-year 2000))
448 (set-time-zone-rule "CET") ;;FIXME: reset timezone!
450 (let ((calendar-month-name-array
451 ["January" "February" "March" "April" "May" "June" "July" "August"
452 "September" "October" "November" "December"])
453 (calendar-day-name-array
454 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
456 (setq calendar-date-style
'iso
)
457 (icalendar-testsuite--do-test-export input-iso expected-output
)))
459 (let ((calendar-month-name-array
460 ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
461 "September" "Oktober" "November" "Dezember"])
462 (calendar-day-name-array
463 ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
465 (setq calendar-date-style
'european
)
466 (icalendar-testsuite--do-test-export input-european expected-output
)))
468 (let ((calendar-month-name-array
469 ["January" "February" "March" "April" "May" "June" "July" "August"
470 "September" "October" "November" "December"])
471 (calendar-day-name-array
472 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
474 (setq calendar-date-style
'american
)
475 (icalendar-testsuite--do-test-export input-american expected-output
)))))
477 (defun icalendar-testsuite--do-test-export (input expected-output
)
478 "Actually perform export test.
479 Argument INPUT input diary string.
480 Argument EXPECTED-OUTPUT expected icalendar result string."
481 (let ((temp-file (make-temp-file "icalendar-testsuite-ics")))
484 (icalendar-export-region (point-min) (point-max) temp-file
))
486 (find-file temp-file
)
487 (goto-char (point-min))
489 (cond (expected-output
490 (and (re-search-forward "^\\s-*BEGIN:VCALENDAR
491 PRODID:-//Emacs//NONSGML icalendar.el//EN
502 (regexp-quote (buffer-substring-no-properties
503 (match-beginning 1) (match-end 1)))
507 (re-search-forward "^\\s-*BEGIN:VCALENDAR
508 PRODID:-//Emacs//NONSGML icalendar.el//EN
514 "Export test failed! Input: `%s'\nFound:\n\n%s\n\nbut expected\n\n%s"
516 (or (and (match-beginning 1)
517 (buffer-substring-no-properties (match-beginning 1) (match-end 1)))
519 (or expected-output
"<nil>"))))
520 (kill-buffer (find-buffer-visiting temp-file
))
521 (delete-file temp-file
)))
523 ;; ======================================================================
524 ;; Test methods for importing from icalendar to diary
525 ;; ======================================================================
527 (defun icalendar-testsuite--test-import (input expected-iso expected-european
529 "Perform import test.
530 Argument INPUT icalendar event string.
531 Argument EXPECTED-ISO expected iso style diary string.
532 Argument EXPECTED-EUROPEAN expected european style diary string.
533 Argument EXPECTED-AMERICAN expected american style diary string."
534 (message "--- icalendar-testsuite--test-import ---")
535 (let ((timezone (cadr (current-time-zone))))
536 (set-time-zone-rule "CET")
538 (if (string-match "^BEGIN:VCALENDAR" input
)
540 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
541 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
543 (unless (eq (char-before) ?
\n)
545 (insert "END:VEVENT\nEND:VCALENDAR\n"))
546 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
547 (icalendar-import-format-summary "%s")
548 (icalendar-import-format-location "\n Location: %s")
549 (icalendar-import-format-description "\n Desc: %s")
550 (icalendar-import-format-organizer "\n Organizer: %s")
551 (icalendar-import-format-status "\n Status: %s")
552 (icalendar-import-format-url "\n URL: %s")
553 (icalendar-import-format-class "\n Class: %s")
556 (setq calendar-date-style
'iso
)
557 (icalendar-testsuite--do-test-import input expected-iso
))
558 (when expected-european
559 (setq calendar-date-style
'european
)
560 (icalendar-testsuite--do-test-import input expected-european
))
561 (when expected-american
562 (setq calendar-date-style
'american
)
563 (icalendar-testsuite--do-test-import input expected-american
))))
564 (set-time-zone-rule timezone
)))
566 (defun icalendar-testsuite--do-test-import (input expected-output
)
567 "Actually perform import test.
568 Argument INPUT input icalendar string.
569 Argument EXPECTED-OUTPUT expected diary string."
570 (let ((temp-file (make-temp-file "icalendar-test-diary")))
571 (icalendar-import-buffer temp-file t t
)
573 (find-file temp-file
)
574 (let ((result (buffer-substring-no-properties (point-min) (point-max))))
575 (unless (string-match (concat "^\\s-*" expected-output
"\\s-*$")
577 (error "Import test failed! Found `%s'\nbut expected `%s'" result
579 (kill-buffer (find-buffer-visiting temp-file
))
580 (delete-file temp-file
))))
582 ;; ======================================================================
583 ;; Test methods for cycle...
584 ;; ======================================================================
585 (defun icalendar-testsuite--test-cycle (input)
587 Argument INPUT icalendar event string."
589 (if (string-match "^BEGIN:VCALENDAR" input
)
591 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
592 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
594 (unless (eq (char-before) ?
\n)
596 (insert "END:VEVENT\nEND:VCALENDAR\n"))
597 (let ((icalendar-import-format "%s%d%l%o%t%u%c")
598 (icalendar-import-format-summary "%s")
599 (icalendar-import-format-location "\n Location: %s")
600 (icalendar-import-format-description "\n Desc: %s")
601 (icalendar-import-format-organizer "\n Organizer: %s")
602 (icalendar-import-format-status "\n Status: %s")
603 (icalendar-import-format-url "\n URL: %s")
604 (icalendar-import-format-class "\n Class: %s"))
605 (dolist (calendar-date-style '(iso european american
))
606 (icalendar-testsuite--do-test-cycle)))))
608 (defun icalendar-testsuite--do-test-cycle ()
609 "Actually perform import/export cycle test."
610 (let ((temp-diary (make-temp-file "icalendar-test-diary"))
611 (temp-ics (make-temp-file "icalendar-test-ics"))
612 (org-input (buffer-substring-no-properties (point-min) (point-max))))
615 (icalendar-import-buffer temp-diary t t
)
617 ;; step 2: export what was just imported
619 (find-file temp-diary
)
620 (icalendar-export-region (point-min) (point-max) temp-ics
))
622 ;; compare the output of step 2 with the input of step 1
625 (goto-char (point-min))
626 (when (re-search-forward "\nUID:.*\n" nil t
)
627 (replace-match "\n"))
628 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
629 (unless (string-equal org-input cycled
)
630 (error "Import test failed! Found `%s'\nbut expected `%s'" cycled
633 ;; clean up -- Note this is done only if test is passed
634 (kill-buffer (find-buffer-visiting temp-diary
))
636 (set-buffer (find-buffer-visiting temp-ics
))
637 (set-buffer-modified-p nil
)
638 (kill-buffer (current-buffer)))
639 (delete-file temp-diary
)
640 (delete-file temp-ics
)))
642 ;; ======================================================================
644 ;; ======================================================================
645 (defun icalendar-testsuite--run-import-tests ()
646 "Perform standard import tests."
647 (icalendar-testsuite--test-import
648 "SUMMARY:non-recurring
649 DTSTART;VALUE=DATE-TIME:20030919T090000
650 DTEND;VALUE=DATE-TIME:20030919T113000"
651 "&2003/9/19 09:00-11:30 non-recurring"
652 "&19/9/2003 09:00-11:30 non-recurring"
653 "&9/19/2003 09:00-11:30 non-recurring")
655 (icalendar-testsuite--test-import
656 "SUMMARY:non-recurring allday
657 DTSTART;VALUE=DATE-TIME:20030919"
658 "&2003/9/19 non-recurring allday"
659 "&19/9/2003 non-recurring allday"
660 "&9/19/2003 non-recurring allday")
662 (icalendar-testsuite--test-import
665 DTSTART;VALUE=DATE:20030919"
666 "&2003/9/19 long summary"
667 "&19/9/2003 long summary"
668 "&9/19/2003 long summary")
670 (icalendar-testsuite--test-import
671 "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
675 X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
676 X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
677 DTSTART;VALUE=DATE:20040719
678 DTEND;VALUE=DATE:20040828
679 DTSTAMP:20031103T011641Z
681 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien"
682 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien"
683 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien")
685 (icalendar-testsuite--test-import
687 :04979712-3902-11d9-93dd-8f9f4afe08da
694 X-MOZILLA-ALARM-DEFAULT-LENGTH
705 "&2004/11/23 14:00-14:30 folded summary"
706 "&23/11/2004 14:00-14:30 folded summary"
707 "&11/23/2004 14:00-14:30 folded summary")
708 (icalendar-testsuite--test-import
710 :6161a312-3902-11d9-b512-f764153bb28b
717 X-MOZILLA-ALARM-DEFAULT-LENGTH
726 "&2004/11/23 14:45-15:45 another example"
727 "&23/11/2004 14:45-15:45 another example"
728 "&11/23/2004 14:45-15:45 another example")
730 (icalendar-testsuite--test-import
732 DTSTART;VALUE=DATE-TIME:20030919T090000
733 DTEND;VALUE=DATE-TIME:20030919T113000
736 "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily"
737 "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily"
738 "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily")
741 (icalendar-testsuite--test-import
743 DTSTART;VALUE=DATE-TIME:20030919T090000
744 DTEND;VALUE=DATE-TIME:20030919T113000
745 RRULE:FREQ=DAILY;INTERVAL=2
747 "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily"
748 "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily"
749 "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily")
750 (icalendar-testsuite--test-import
751 "SUMMARY:rrule daily with exceptions
752 DTSTART;VALUE=DATE-TIME:20030919T090000
753 DTEND;VALUE=DATE-TIME:20030919T113000
754 RRULE:FREQ=DAILY;INTERVAL=2
755 EXDATE:20030921,20030925
757 "&%%(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"
758 "&%%(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"
759 "&%%(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")
761 (icalendar-testsuite--test-import
762 "SUMMARY:rrule weekly
763 DTSTART;VALUE=DATE-TIME:20030919T090000
764 DTEND;VALUE=DATE-TIME:20030919T113000
767 "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly"
768 "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly"
769 "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly")
770 (icalendar-testsuite--test-import
771 "SUMMARY:rrule monthly no end
772 DTSTART;VALUE=DATE-TIME:20030919T090000
773 DTEND;VALUE=DATE-TIME:20030919T113000
776 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end"
777 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end"
778 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end")
779 (icalendar-testsuite--test-import
780 "SUMMARY:rrule monthly with end
781 DTSTART;VALUE=DATE-TIME:20030919T090000
782 DTEND;VALUE=DATE-TIME:20030919T113000
783 RRULE:FREQ=MONTHLY;UNTIL=20050819;
785 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end"
786 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end"
787 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end")
788 (icalendar-testsuite--test-import
789 "DTSTART;VALUE=DATE:20040815
790 DTEND;VALUE=DATE:20040816
791 SUMMARY:Maria Himmelfahrt
792 UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
793 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
795 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt"
796 "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt"
797 "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt")
798 (icalendar-testsuite--test-import
799 "SUMMARY:rrule yearly
800 DTSTART;VALUE=DATE-TIME:20030919T090000
801 DTEND;VALUE=DATE-TIME:20030919T113000
802 RRULE:FREQ=YEARLY;INTERVAL=2
804 "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly" ;FIXME
805 "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly" ;FIXME
806 "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly") ;FIXME
807 (icalendar-testsuite--test-import
808 "SUMMARY:rrule count daily short
809 DTSTART;VALUE=DATE-TIME:20030919T090000
810 DTEND;VALUE=DATE-TIME:20030919T113000
811 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
813 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short"
814 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short"
815 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short")
816 (icalendar-testsuite--test-import
817 "SUMMARY:rrule count daily long
818 DTSTART;VALUE=DATE-TIME:20030919T090000
819 DTEND;VALUE=DATE-TIME:20030919T113000
820 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
822 "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long"
823 "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long"
824 "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long")
825 (icalendar-testsuite--test-import
826 "SUMMARY:rrule count bi-weekly 3 times
827 DTSTART;VALUE=DATE-TIME:20030919T090000
828 DTEND;VALUE=DATE-TIME:20030919T113000
829 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
831 "&%%(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"
832 "&%%(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"
833 "&%%(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")
834 (icalendar-testsuite--test-import
835 "SUMMARY:rrule count monthly
836 DTSTART;VALUE=DATE-TIME:20030919T090000
837 DTEND;VALUE=DATE-TIME:20030919T113000
838 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
840 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly"
841 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly"
842 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly")
843 (icalendar-testsuite--test-import
844 "SUMMARY:rrule count every second month
845 DTSTART;VALUE=DATE-TIME:20030919T090000
846 DTEND;VALUE=DATE-TIME:20030919T113000
847 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
849 "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month" ;FIXME
850 "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month" ;FIXME
851 "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month") ;FIXME
852 (icalendar-testsuite--test-import
853 "SUMMARY:rrule count yearly
854 DTSTART;VALUE=DATE-TIME:20030919T090000
855 DTEND;VALUE=DATE-TIME:20030919T113000
856 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
858 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly"
859 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly"
860 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly")
861 (icalendar-testsuite--test-import
862 "SUMMARY:rrule count every second year
863 DTSTART;VALUE=DATE-TIME:20030919T090000
864 DTEND;VALUE=DATE-TIME:20030919T113000
865 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
867 "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year" ;FIXME!!!
868 "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year" ;FIXME!!!
869 "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year") ;FIXME!!!
872 (icalendar-testsuite--test-import
873 "DTSTART;VALUE=DATE:20050217
877 "&%%(and (diary-block 2005 2 17 2005 2 23)) duration"
878 "&%%(and (diary-block 17 2 2005 23 2 2005)) duration"
879 "&%%(and (diary-block 2 17 2005 2 23 2005)) duration")
881 (icalendar-testsuite--test-import
882 "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
883 DTSTAMP:20041127T183315Z
884 LAST-MODIFIED:20041127T183329
886 DTSTART;VALUE=DATE:20011221
887 DTEND;VALUE=DATE:20011221
888 RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
891 CREATED:20041127T183329
893 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub"
894 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub"
895 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub")
898 ;; ======================================================================
900 ;; ======================================================================
901 (defun icalendar-testsuite--run-export-tests ()
902 "Perform standard export tests."
904 (let ((icalendar-export-hidden-diary-entries nil
))
905 (icalendar-testsuite--test-export
906 "&2000 Oct 3 ordinary no time "
907 "&3 Okt 2000 ordinary no time "
908 "&Oct 3 2000 ordinary no time "
912 (icalendar-testsuite--test-export
913 "2000 Oct 3 ordinary no time "
914 "3 Okt 2000 ordinary no time "
915 "Oct 3 2000 ordinary no time "
916 "DTSTART;VALUE=DATE:20001003
917 DTEND;VALUE=DATE:20001004
918 SUMMARY:ordinary no time
920 (icalendar-testsuite--test-export
921 "2000 Oct 3 16:30 ordinary with time"
922 "3 Okt 2000 16:30 ordinary with time"
923 "Oct 3 2000 16:30 ordinary with time"
924 "DTSTART;VALUE=DATE-TIME:20001003T163000
925 DTEND;VALUE=DATE-TIME:20001003T173000
926 SUMMARY:ordinary with time
928 (icalendar-testsuite--test-export
929 "2000 10 3 16:30 ordinary with time 2"
930 "3 10 2000 16:30 ordinary with time 2"
931 "10 3 2000 16:30 ordinary with time 2"
932 "DTSTART;VALUE=DATE-TIME:20001003T163000
933 DTEND;VALUE=DATE-TIME:20001003T173000
934 SUMMARY:ordinary with time 2
937 (icalendar-testsuite--test-export
938 "2000/10/3 16:30 ordinary with time 3"
939 "3/10/2000 16:30 ordinary with time 3"
940 "10/3/2000 16:30 ordinary with time 3"
941 "DTSTART;VALUE=DATE-TIME:20001003T163000
942 DTEND;VALUE=DATE-TIME:20001003T173000
943 SUMMARY:ordinary with time 3
946 ;; multiline -- FIXME!!!
947 (icalendar-testsuite--test-export
948 "2000 October 3 16:30 multiline
949 17:30 multiline continued FIXME"
950 "3 Oktober 2000 16:30 multiline
951 17:30 multiline continued FIXME"
952 "October 3 2000 16:30 multiline
953 17:30 multiline continued FIXME"
954 "DTSTART;VALUE=DATE-TIME:20001003T163000
955 DTEND;VALUE=DATE-TIME:20001003T173000
958 17:30 multiline continued FIXME
962 (icalendar-testsuite--test-export
963 "Monday 1:30pm weekly by day with start time"
964 "Montag 13:30 weekly by day with start time"
965 "Monday 1:30pm weekly by day with start time"
966 "DTSTART;VALUE=DATE-TIME:20000103T133000
967 DTEND;VALUE=DATE-TIME:20000103T143000
968 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
969 SUMMARY:weekly by day with start time
972 (icalendar-testsuite--test-export
973 "Monday 13:30-15:00 weekly by day with start and end time"
974 "Montag 13:30-15:00 weekly by day with start and end time"
975 "Monday 01:30pm-03:00pm weekly by day with start and end time"
976 "DTSTART;VALUE=DATE-TIME:20000103T133000
977 DTEND;VALUE=DATE-TIME:20000103T150000
978 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
979 SUMMARY:weekly by day with start and end time
983 (icalendar-testsuite--test-export
984 "may 1 yearly no time"
985 "1 Mai yearly no time"
986 "may 1 yearly no time"
987 "DTSTART;VALUE=DATE:19000501
988 DTEND;VALUE=DATE:19000502
989 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
990 SUMMARY:yearly no time
994 (icalendar-testsuite--test-export
995 "%%(diary-anniversary 1989 10 3) anniversary no time"
996 "%%(diary-anniversary 3 10 1989) anniversary no time"
997 "%%(diary-anniversary 10 3 1989) anniversary no time"
998 "DTSTART;VALUE=DATE:19891003
999 DTEND;VALUE=DATE:19891004
1000 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
1001 SUMMARY:anniversary no time
1003 (icalendar-testsuite--test-export
1004 "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
1005 "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
1006 "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
1007 "DTSTART;VALUE=DATE-TIME:19891003T190000
1008 DTEND;VALUE=DATE-TIME:19891004T200000
1009 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
1010 SUMMARY:anniversary with time
1014 (icalendar-testsuite--test-export
1015 "%%(diary-block 2001 6 18 2001 7 6) block no time"
1016 "%%(diary-block 18 6 2001 6 7 2001) block no time"
1017 "%%(diary-block 6 18 2001 7 6 2001) block no time"
1018 "DTSTART;VALUE=DATE:20010618
1019 DTEND;VALUE=DATE:20010707
1020 SUMMARY:block no time
1022 (icalendar-testsuite--test-export
1023 "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
1024 "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
1025 "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
1026 "DTSTART;VALUE=DATE-TIME:20010618T130000
1027 DTEND;VALUE=DATE-TIME:20010618T170000
1028 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
1029 SUMMARY:block with time
1031 (icalendar-testsuite--test-export
1032 "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
1033 "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
1034 "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
1035 "DTSTART;VALUE=DATE-TIME:20010618T130000
1036 DTEND;VALUE=DATE-TIME:20010618T140000
1037 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
1038 SUMMARY:block no end time
1042 ;; ======================================================================
1044 ;; ======================================================================
1045 (defun icalendar-testsuite--run-real-world-tests ()
1046 "Perform real-world tests, as gathered from problem reports."
1048 (icalendar-testsuite--test-import
1051 PRODID:Microsoft CDO for Microsoft Exchange
1054 TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
1055 X-MICROSOFT-CDO-TZID:23
1057 DTSTART:16010101T000000
1062 DTSTART:16010101T000000
1068 DTSTAMP:20030509T043439Z
1069 DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
1070 SUMMARY:On-Site Interview
1071 UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
1072 010000000DB823520692542408ED02D7023F9DFF9
1073 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
1074 xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
1075 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
1076 yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
1077 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
1078 zz\":MAILTO:zzzzzz@zzzzzzz.com
1079 ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
1081 DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
1082 DESCRIPTION:10:30am - Blah
1086 CREATED:20030509T043439Z
1087 LAST-MODIFIED:20030509T043459Z
1090 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1091 X-MICROSOFT-CDO-INSTTYPE:0
1092 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1093 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1094 X-MICROSOFT-CDO-IMPORTANCE:1
1095 X-MICROSOFT-CDO-OWNERAPPTID:126441427
1098 DESCRIPTION:REMINDER
1099 TRIGGER;RELATED=START:-PT00H15M00S
1104 "&9/5/2003 10:30-15:30 On-Site Interview
1105 Desc: 10:30am - Blah
1107 Organizer: MAILTO:aaaaaaa@aaaaaaa.com"
1108 "&5/9/2003 10:30-15:30 On-Site Interview
1109 Desc: 10:30am - Blah
1111 Organizer: MAILTO:aaaaaaa@aaaaaaa.com")
1114 (icalendar-testsuite--test-import
1115 "DTSTAMP:20030618T195512Z
1116 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
1117 SUMMARY:Dress Rehearsal for XXXX-XXXX
1118 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1119 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1120 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
1121 AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
1122 ORGANIZER;CN=\"ABCD,TECHTRAINING
1123 (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
1124 LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
1125 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
1126 DESCRIPTION:753 Zeichen hier radiert
1130 CREATED:20030618T195518Z
1131 LAST-MODIFIED:20030618T195527Z
1134 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1135 X-MICROSOFT-CDO-INSTTYPE:0
1136 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1137 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1138 X-MICROSOFT-CDO-IMPORTANCE:1
1139 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1142 DESCRIPTION:REMINDER
1143 TRIGGER;RELATED=START:-PT00H15M00S
1146 "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1147 Desc: 753 Zeichen hier radiert
1148 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1149 Organizer: MAILTO:xxx@xxxxx.com"
1150 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1151 Desc: 753 Zeichen hier radiert
1152 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1153 Organizer: MAILTO:xxx@xxxxx.com")
1155 ;; 2003-06-18 b -- uses timezone
1156 (icalendar-testsuite--test-import
1159 PRODID:Microsoft CDO for Microsoft Exchange
1162 TZID:Mountain Time (US & Canada)
1163 X-MICROSOFT-CDO-TZID:12
1165 DTSTART:16010101T020000
1168 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
1171 DTSTART:16010101T020000
1174 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
1178 DTSTAMP:20030618T230323Z
1179 DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
1180 SUMMARY:Updated: Dress Rehearsal for ABC01-15
1181 UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
1182 0100000007C3A6D65EE726E40B7F3D69A23BD567E
1183 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
1184 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
1185 \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
1187 ORGANIZER;CN=\"ABCD,TECHTRAINING
1188 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
1189 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
1190 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
1191 DESCRIPTION:Viele Zeichen standen hier früher
1195 CREATED:20030618T230326Z
1196 LAST-MODIFIED:20030618T230335Z
1199 X-MICROSOFT-CDO-BUSYSTATUS:BUSY
1200 X-MICROSOFT-CDO-INSTTYPE:0
1201 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1202 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1203 X-MICROSOFT-CDO-IMPORTANCE:1
1204 X-MICROSOFT-CDO-OWNERAPPTID:1022519251
1207 DESCRIPTION:REMINDER
1208 TRIGGER;RELATED=START:-PT00H15M00S
1213 "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1214 Desc: Viele Zeichen standen hier früher
1215 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1216 Organizer: MAILTO:bbb@bbbbb.com
1218 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1219 Desc: Viele Zeichen standen hier früher
1220 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1221 Organizer: MAILTO:bbb@bbbbb.com
1224 ;; export 2004-10-28 block entries
1225 (icalendar-testsuite--test-export
1228 "-*- mode: text; fill-column: 256;-*-
1232 %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
1234 "DTSTART;VALUE=DATE:20041108
1235 DTEND;VALUE=DATE:20041111
1236 SUMMARY:Nov 8-10 aa")
1238 (icalendar-testsuite--test-export
1241 "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
1242 "DTSTART;VALUE=DATE:20041213
1243 DTEND;VALUE=DATE:20041218
1244 SUMMARY:Dec 13-17 bb")
1246 (icalendar-testsuite--test-export
1249 "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
1250 "DTSTART;VALUE=DATE:20050203
1251 DTEND;VALUE=DATE:20050205
1252 SUMMARY:Feb 3-4 cc")
1254 (icalendar-testsuite--test-export
1257 "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
1258 "DTSTART;VALUE=DATE:20050424
1259 DTEND;VALUE=DATE:20050430
1260 SUMMARY:April 24-29 dd
1262 (icalendar-testsuite--test-export
1265 "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
1266 "DTSTART;VALUE=DATE:20050530
1267 DTEND;VALUE=DATE:20050602
1268 SUMMARY:may 30 - June 1: ee")
1270 (icalendar-testsuite--test-export
1273 "%%(diary-block 6 6 2005 6 8 2005) ff"
1274 "DTSTART;VALUE=DATE:20050606
1275 DTEND;VALUE=DATE:20050609
1278 ;; export 2004-10-28 anniversary entries
1279 (icalendar-testsuite--test-export
1285 %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
1286 "DTSTART;VALUE=DATE:19910328
1287 DTEND;VALUE=DATE:19910329
1288 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
1289 SUMMARY:aa birthday (%d years old)
1292 (icalendar-testsuite--test-export
1295 "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
1296 "DTSTART;VALUE=DATE:19570517
1297 DTEND;VALUE=DATE:19570518
1298 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
1299 SUMMARY:bb birthday (%d years old)")
1301 (icalendar-testsuite--test-export
1304 "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
1305 "DTSTART;VALUE=DATE:19970608
1306 DTEND;VALUE=DATE:19970609
1307 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
1308 SUMMARY:cc birthday (%d years old)")
1310 (icalendar-testsuite--test-export
1313 "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
1314 "DTSTART;VALUE=DATE:19830722
1315 DTEND;VALUE=DATE:19830723
1316 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
1317 SUMMARY:dd (%d years ago...!)")
1319 (icalendar-testsuite--test-export
1322 "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
1323 "DTSTART;VALUE=DATE:19880801
1324 DTEND;VALUE=DATE:19880802
1325 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
1326 SUMMARY:ee birthday (%d years old)")
1328 (icalendar-testsuite--test-export
1331 "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
1332 "DTSTART;VALUE=DATE:19570921
1333 DTEND;VALUE=DATE:19570922
1334 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
1335 SUMMARY:ff birthday (%d years old)")
1340 ;; export 2004-10-28 monthly, weekly entries
1342 ;; (icalendar-testsuite--test-export
1345 ;; >>> ------------ monthly:
1347 ;; */27/* 10:00 blah blah"
1350 (icalendar-testsuite--test-export
1353 ">>> ------------ my week:
1356 "DTSTART;VALUE=DATE-TIME:20000103T130000
1357 DTEND;VALUE=DATE-TIME:20000103T140000
1358 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1361 (icalendar-testsuite--test-export
1365 "DTSTART;VALUE=DATE-TIME:20000103T150000
1366 DTEND;VALUE=DATE-TIME:20000103T160000
1367 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1371 (icalendar-testsuite--test-export
1374 "Monday 16:00-17:00 a2"
1375 "DTSTART;VALUE=DATE-TIME:20000103T160000
1376 DTEND;VALUE=DATE-TIME:20000103T170000
1377 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1380 (icalendar-testsuite--test-export
1383 "Tuesday 11:30-13:00 a3"
1384 "DTSTART;VALUE=DATE-TIME:20000104T113000
1385 DTEND;VALUE=DATE-TIME:20000104T130000
1386 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1389 (icalendar-testsuite--test-export
1393 "DTSTART;VALUE=DATE-TIME:20000104T150000
1394 DTEND;VALUE=DATE-TIME:20000104T160000
1395 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
1398 (icalendar-testsuite--test-export
1401 "Wednesday 13:00 a5"
1402 "DTSTART;VALUE=DATE-TIME:20000105T130000
1403 DTEND;VALUE=DATE-TIME:20000105T140000
1404 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1407 (icalendar-testsuite--test-export
1410 "Wednesday 11:30-13:30 a6"
1411 "DTSTART;VALUE=DATE-TIME:20000105T113000
1412 DTEND;VALUE=DATE-TIME:20000105T133000
1413 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1416 (icalendar-testsuite--test-export
1419 "Wednesday 15:00 s1"
1420 "DTSTART;VALUE=DATE-TIME:20000105T150000
1421 DTEND;VALUE=DATE-TIME:20000105T160000
1422 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
1426 ;; export 2004-10-28 regular entries
1427 (icalendar-testsuite--test-export
1431 >>> regular diary entries:
1433 Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
1434 "DTSTART;VALUE=DATE-TIME:20041012T140000
1435 DTEND;VALUE=DATE-TIME:20041012T150000
1436 SUMMARY:Tue: [2004-10-12] q1")
1439 (icalendar-testsuite--test-import
1444 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1447 :04979712-3902-11d9-93dd-8f9f4afe08da
1454 X-MOZILLA-ALARM-DEFAULT-LENGTH
1467 :6161a312-3902-11d9-b512-f764153bb28b
1474 X-MOZILLA-ALARM-DEFAULT-LENGTH
1485 :943a4d7e-3902-11d9-9ce7-c9addeadf928
1492 X-MOZILLA-ALARM-DEFAULT-LENGTH
1503 :fe53615e-3902-11d9-9dd8-9d38a155bf41
1510 X-MOZILLA-ALARM-DEFAULT-LENGTH
1512 X-MOZILLA-RECUR-DEFAULT-INTERVAL
1515 :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
1525 :87c928ee-3901-11d9-b21f-b45042155024
1527 :Rrrr/Cccccc ii Aaaaaaaa
1529 :Vvvvv Rrrr aaa Cccccc
1534 X-MOZILLA-ALARM-DEFAULT-LENGTH
1549 :e8f331ae-3902-11d9-9948-dfdcb66a2872
1556 X-MOZILLA-ALARM-DEFAULT-LENGTH
1559 :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
1574 "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
1577 &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1580 &23/11/2004 11:00-12:00 Hhhhhhhh
1583 &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
1586 &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
1587 Desc: Vvvvv Rrrr aaa Cccccc
1590 &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
1593 "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
1596 &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
1599 &11/23/2004 11:00-12:00 Hhhhhhhh
1602 &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
1605 &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
1606 Desc: Vvvvv Rrrr aaa Cccccc
1609 &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
1614 (icalendar-testsuite--test-export
1615 "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
1618 "DTSTART;VALUE=DATE:20040101
1619 DTEND;VALUE=DATE:20040105
1623 (icalendar-testsuite--test-export
1625 "5 11 2004 Bla Fasel"
1627 "DTSTART;VALUE=DATE:20041105
1628 DTEND;VALUE=DATE:20041106
1632 (icalendar-testsuite--test-export
1634 "2 Nov 2004 15:00-16:30 Zahnarzt"
1636 "DTSTART;VALUE=DATE-TIME:20041102T150000
1637 DTEND;VALUE=DATE-TIME:20041102T163000
1641 (icalendar-testsuite--test-import
1643 :b60d398e-1dd1-11b2-a159-cf8cb05139f4
1663 "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
1665 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
1669 (icalendar-testsuite--test-import
1670 "DTSTART;VALUE=DATE:20050217
1671 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
1672 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
1673 DTSTAMP:20050118T210335Z
1676 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa"
1677 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa")
1680 (icalendar-testsuite--test-export
1682 "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
1684 "DTSTART;VALUE=DATE-TIME:20050208T160000
1685 DTEND;VALUE=DATE-TIME:20050208T164500
1686 RRULE:FREQ=DAILY;INTERVAL=7
1691 (icalendar-testsuite--test-export
1694 ;; FIXME: colon not allowed!
1695 ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
1696 "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
1697 "DTSTART;VALUE=DATE:19001101
1698 DTEND;VALUE=DATE:19001102
1699 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
1700 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
1704 (defun icalendar-testsuite--run-cycle-tests ()
1705 "Perform cycling tests."
1706 (icalendar-testsuite--test-cycle
1707 "DTSTART;VALUE=DATE-TIME:20030919T090000
1708 DTEND;VALUE=DATE-TIME:20030919T113000
1712 (icalendar-testsuite--test-cycle
1713 "DTSTART;VALUE=DATE-TIME:20030919T090000
1714 DTEND;VALUE=DATE-TIME:20030919T113000
1716 DESCRIPTION:beschreibung!
1721 (icalendar-testsuite--test-cycle
1722 "DTSTART;VALUE=DATE:19190909
1723 DTEND;VALUE=DATE:19190910
1724 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1725 SUMMARY:and diary-anniversary
1730 (provide 'icalendar-testsuite
)
1732 ;; arch-tag: 33a98396-90e9-49c8-b0e9-b606386d6e8c
1733 ;;; icalendar-testsuite.el ends here