Commit 7ec01532 authored by Glenn Morris's avatar Glenn Morris
Browse files

Ulf Jasper <ulf.jasper at web.de>: New file.

parent 366b88a2
;; icalendar-testsuite.el --- Test suite for icalendar.el
;; Copyright (C) 2005, 2008 Free Software Foundation, Inc.
;; Author: Ulf Jasper <ulf.jasper@web.de>
;; Created: March 2005
;; Keywords: calendar
;; Human-Keywords: calendar, diary, iCalendar, vCalendar
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; TODO:
;; - Add more unit tests for functions, timezone etc.
;;; Code:
(defun icalendar-testsuite-run ()
"Run icalendar test suite."
(interactive)
(icalendar-testsuite--run-function-tests)
(icalendar-testsuite--run-import-tests)
(icalendar-testsuite--run-export-tests)
(icalendar-testsuite--run-cycle-tests)
(icalendar-testsuite--run-real-world-tests)
(message "All icalendar tests finished successfully."))
;; ======================================================================
;; Test methods for functions
;; ======================================================================
(defun icalendar-testsuite--run-function-tests ()
"Perform tests for single icalendar functions."
(icalendar-testsuite--test-parse-summary-and-rest)
(icalendar-testsuite--test-format-ical-event)
(icalendar-testsuite--test-import-format-sample)
(icalendar-testsuite--test-first-weekday-of-year))
(defun icalendar-testsuite--test-format-ical-event ()
"Test icalendar--format-ical-event"
(let ((icalendar-import-format "%s%d%l%o%t%u%c")
(icalendar-import-format-summary "SUM %s")
(icalendar-import-format-location " LOC %s")
(icalendar-import-format-description " DES %s")
(icalendar-import-format-organizer " ORG %s")
(icalendar-import-format-status " STA %s")
(icalendar-import-format-url " URL %s")
(icalendar-import-format-class " CLA %s")
(was-european-calendar european-calendar-style)
(event (icalendar-testsuite--get-ical-event "BEGIN:VEVENT
DTSTAMP:20030509T043439Z
DTSTART:20030509T103000
SUMMARY:sum
ORGANIZER:org
LOCATION:loc
DTEND:20030509T153000
DESCRIPTION:des
END:VEVENT
")))
(assert (string= (icalendar--format-ical-event event)
"SUM sum DES des LOC loc ORG org") t)
(setq icalendar-import-format (lambda (&rest ignore)
"helloworld"))
(assert (string= (icalendar--format-ical-event event)
"helloworld") t)
(setq icalendar-import-format
(lambda (e)
(format "-%s-%s-%s-%s-%s-%s-%s-"
(icalendar--get-event-property event 'SUMMARY)
(icalendar--get-event-property event 'DESCRIPTION)
(icalendar--get-event-property event 'LOCATION)
(icalendar--get-event-property event 'ORGANIZER)
(icalendar--get-event-property event 'STATUS)
(icalendar--get-event-property event 'URL)
(icalendar--get-event-property event 'CLASS))))
(assert (string= (icalendar--format-ical-event event)
"-sum-des-loc-org-nil-nil-nil-") t)))
(defun icalendar-testsuite--test-parse-summary-and-rest ()
"Test icalendar--parse-summary-and-rest."
(let ((icalendar-import-format "%s%d%l%o%t%u%c")
(icalendar-import-format-summary "SUM %s")
(icalendar-import-format-location " LOC %s")
(icalendar-import-format-description " DES %s")
(icalendar-import-format-organizer " ORG %s")
(icalendar-import-format-status " STA %s")
(icalendar-import-format-url " URL %s")
(icalendar-import-format-class " CLA %s")
(was-european-calendar european-calendar-style)
(result))
;; FIXME: need a trailing blank char!
(setq result (icalendar--parse-summary-and-rest "SUM sum ORG org "))
(assert (string= (cdr (assoc 'org result)) "org"))
(setq result (icalendar--parse-summary-and-rest
"SUM sum DES des LOC loc ORG org STA sta URL url CLA cla "))
(assert (string= (cdr (assoc 'des result)) "des"))
(assert (string= (cdr (assoc 'loc result)) "loc"))
(assert (string= (cdr (assoc 'org result)) "org"))
(assert (string= (cdr (assoc 'sta result)) "sta"))
(assert (string= (cdr (assoc 'cla result)) "cla"))
(setq icalendar-import-format (lambda () "Hello world"))
(setq result (icalendar--parse-summary-and-rest
"blah blah "))
(assert (not result))
))
(defun icalendar-testsuite--get-ical-event (ical-string)
"Helper function for testing `icalendar-testsuite--test-format-ical-event'."
(save-excursion
(with-temp-buffer
(insert ical-string)
(goto-char (point-min))
(car (icalendar--read-element nil nil)))))
(defun icalendar-testsuite--test-import-format-sample ()
"Test method for `icalendar-import-format-sample'."
(assert (string= (icalendar-import-format-sample
(icalendar-testsuite--get-ical-event "BEGIN:VEVENT
DTSTAMP:20030509T043439Z
DTSTART:20030509T103000
SUMMARY:a
ORGANIZER:d
LOCATION:c
DTEND:20030509T153000
DESCRIPTION:b
END:VEVENT
"))
(concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
"ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'"))))
(defun icalendar-testsuite--test-first-weekday-of-year ()
(assert (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
(assert (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
(assert (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
(assert (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
(assert (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
(assert (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
(assert (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
(assert (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
(assert (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
;; ======================================================================
;; Test methods for exporting from diary to icalendar
;; ======================================================================
(defun icalendar-testsuite--test-export (input-european input-american
expected-output)
"Perform an export test.
Argument INPUT-EUROPEAN european style diary string.
Argument INPUT-AMERICAN american style diary string.
Argument EXPECTED-OUTPUT expected icalendar result string."
(message "--- icalendar-testsuite--test-export ---")
(let ((was-european-calendar european-calendar-style)
(icalendar-recurring-start-year 2000))
(set-time-zone-rule "CET") ;;FIXME: reset timezone!
(when input-european
(let ((calendar-month-name-array
["Januar" "Februar" "Mrz" "April" "Mai" "Juni" "Juli" "August"
"September" "Oktober" "November" "Dezember"])
(calendar-day-name-array
["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
"Samstag"]))
(european-calendar)
(icalendar-testsuite--do-test-export input-european expected-output)))
(when input-american
(let ((calendar-month-name-array
["January" "February" "March" "April" "May" "June" "July" "August"
"September" "October" "November" "December"])
(calendar-day-name-array
["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
"Saturday"]))
(american-calendar)
(icalendar-testsuite--do-test-export input-american expected-output)))
(if was-european-calendar
(european-calendar)
(american-calendar))))
(defun icalendar-testsuite--do-test-export (input expected-output)
"Actually perform export test.
Argument INPUT input diary string.
Argument EXPECTED-OUTPUT expected icalendar result string."
(let ((temp-file (make-temp-file "icalendar-testsuite-ics")))
(with-temp-buffer
(insert input)
(icalendar-export-region (point-min) (point-max) temp-file))
(save-excursion
(find-file temp-file)
(goto-char (point-min))
(unless
(cond (expected-output
(and (re-search-forward "^\\s-*BEGIN:VCALENDAR
PRODID:-//Emacs//NONSGML icalendar.el//EN
VERSION:2.0
BEGIN:VEVENT
UID:emacs[0-9]+
\\(\\(.\\|\n\\)+\\)
END:VEVENT
END:VCALENDAR
\\s-*$"
nil t)
(string-match
(concat "^\\s-*"
(regexp-quote (buffer-substring-no-properties
(match-beginning 1) (match-end 1)))
"\\s-*$")
expected-output)))
(t
(re-search-forward "^\\s-*BEGIN:VCALENDAR
PRODID:-//Emacs//NONSGML icalendar.el//EN
VERSION:2.0
END:VCALENDAR
\\s-*$"
nil t)))
(error
"Export test failed! Input: `%s'\nFound:\n\n%s\n\nbut expected\n\n%s"
input
(or (and (match-beginning 1)
(buffer-substring-no-properties (match-beginning 1) (match-end 1)))
"<nil>")
(or expected-output "<nil>"))))
(kill-buffer (find-buffer-visiting temp-file))
(delete-file temp-file)))
;; ======================================================================
;; Test methods for importing from icalendar to diary
;; ======================================================================
(defun icalendar-testsuite--test-import (input expected-european
expected-american)
"Perform import test.
Argument INPUT icalendar event string.
Argument EXPECTED-EUROPEAN expected european style diary string.
Argument EXPECTED-AMERICAN expected american style diary string."
(message "--- icalendar-testsuite--test-import ---")
(let ((timezone (cadr (current-time-zone))))
(set-time-zone-rule "CET")
(with-temp-buffer
(if (string-match "^BEGIN:VCALENDAR" input)
(insert input)
(insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
(insert "VERSION:2.0\nBEGIN:VEVENT\n")
(insert input)
(unless (eq (char-before) ?\n)
(insert "\n"))
(insert "END:VEVENT\nEND:VCALENDAR\n"))
(let ((icalendar-import-format "%s%d%l%o%t%u%c")
(icalendar-import-format-summary "%s")
(icalendar-import-format-location "\n Location: %s")
(icalendar-import-format-description "\n Desc: %s")
(icalendar-import-format-organizer "\n Organizer: %s")
(icalendar-import-format-status "\n Status: %s")
(icalendar-import-format-url "\n URL: %s")
(icalendar-import-format-class "\n Class: %s")
(was-european-calendar european-calendar-style))
(when expected-european
(european-calendar)
(icalendar-testsuite--do-test-import input expected-european))
(when expected-american
(american-calendar)
(icalendar-testsuite--do-test-import input expected-american))
(if was-european-calendar
(european-calendar)
(american-calendar))))
(set-time-zone-rule timezone)))
(defun icalendar-testsuite--do-test-import (input expected-output)
"Actually perform import test.
Argument INPUT input icalendar string.
Argument EXPECTED-OUTPUT expected diary string."
(let ((temp-file (make-temp-file "icalendar-test-diary")))
(icalendar-import-buffer temp-file t t)
(save-excursion
(find-file temp-file)
(let ((result (buffer-substring-no-properties (point-min) (point-max))))
(unless (string-match (concat "^\\s-*" expected-output "\\s-*$")
result)
(error "Import test failed! Found `%s'\nbut expected `%s'" result
expected-output)))
(kill-buffer (find-buffer-visiting temp-file))
(delete-file temp-file))))
;; ======================================================================
;; Test methods for cycle...
;; ======================================================================
(defun icalendar-testsuite--test-cycle (input)
"Perform cycle test.
Argument INPUT icalendar event string."
(with-temp-buffer
(if (string-match "^BEGIN:VCALENDAR" input)
(insert input)
(insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
(insert "VERSION:2.0\nBEGIN:VEVENT\n")
(insert input)
(unless (eq (char-before) ?\n)
(insert "\n"))
(insert "END:VEVENT\nEND:VCALENDAR\n"))
(let ((icalendar-import-format "%s%d%l%o%t%u%c")
(icalendar-import-format-summary "%s")
(icalendar-import-format-location "\n Location: %s")
(icalendar-import-format-description "\n Desc: %s")
(icalendar-import-format-organizer "\n Organizer: %s")
(icalendar-import-format-status "\n Status: %s")
(icalendar-import-format-url "\n URL: %s")
(icalendar-import-format-class "\n Class: %s")
(was-european-calendar european-calendar-style))
(european-calendar)
(icalendar-testsuite--do-test-cycle)
(american-calendar)
(icalendar-testsuite--do-test-cycle)
(if was-european-calendar
(european-calendar)
(american-calendar)))))
(defun icalendar-testsuite--do-test-cycle ()
"Actually perform import/export cycle test."
(let ((temp-diary (make-temp-file "icalendar-test-diary"))
(temp-ics (make-temp-file "icalendar-test-ics"))
(org-input (buffer-substring-no-properties (point-min) (point-max))))
(icalendar-import-buffer temp-diary t t)
(save-excursion
(find-file temp-diary)
(icalendar-export-region (point-min) (point-max) temp-ics))
(save-excursion
(find-file temp-ics)
(goto-char (point-min))
(when (re-search-forward "\nUID:.*\n" nil t)
(replace-match "\n"))
(let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
(unless (string-equal org-input cycled)
(error "Import test failed! Found `%s'\nbut expected `%s'" cycled
org-input))))
(kill-buffer (find-buffer-visiting temp-diary))
(save-excursion
(set-buffer (find-buffer-visiting temp-ics))
(set-buffer-modified-p nil)
(kill-buffer (current-buffer)))
(delete-file temp-diary)
(delete-file temp-ics)))
;; ======================================================================
;; Import tests
;; ======================================================================
(defun icalendar-testsuite--run-import-tests ()
"Perform standard import tests."
(icalendar-testsuite--test-import
"SUMMARY:non-recurring
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000"
"&19/9/2003 09:00-11:30 non-recurring"
"&9/19/2003 09:00-11:30 non-recurring")
(icalendar-testsuite--test-import
"SUMMARY:non-recurring allday
DTSTART;VALUE=DATE-TIME:20030919"
"&19/9/2003 non-recurring allday"
"&9/19/2003 non-recurring allday")
(icalendar-testsuite--test-import
"SUMMARY:long
summary
DTSTART;VALUE=DATE:20030919"
"&19/9/2003 long summary"
"&9/19/2003 long summary")
(icalendar-testsuite--test-import
"UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
SUMMARY:Sommerferien
STATUS:TENTATIVE
CLASS:PRIVATE
X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
DTSTART;VALUE=DATE:20040719
DTEND;VALUE=DATE:20040828
DTSTAMP:20031103T011641Z
"
"&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien"
"&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien")
(icalendar-testsuite--test-import
"UID
:04979712-3902-11d9-93dd-8f9f4afe08da
SUMMARY
:folded summary
STATUS
:TENTATIVE
CLASS
:PRIVATE
X-MOZILLA-ALARM-DEFAULT-LENGTH
:0
DTSTART
:20041123T140000
DTEND
:20041123T143000
DTSTAMP
:20041118T013430Z
LAST-MODIFIED
:20041118T013640Z
"
"&23/11/2004 14:00-14:30 folded summary"
"&11/23/2004 14:00-14:30 folded summary")
(icalendar-testsuite--test-import
"UID
:6161a312-3902-11d9-b512-f764153bb28b
SUMMARY
:another example
STATUS
:TENTATIVE
CLASS
:PRIVATE
X-MOZILLA-ALARM-DEFAULT-LENGTH
:0
DTSTART
:20041123T144500
DTEND
:20041123T154500
DTSTAMP
:20041118T013641Z
"
"&23/11/2004 14:45-15:45 another example"
"&11/23/2004 14:45-15:45 another example")
(icalendar-testsuite--test-import
"SUMMARY:rrule daily
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=DAILY;
"
"&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily"
"&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily")
;; RRULE examples
(icalendar-testsuite--test-import
"SUMMARY:rrule daily
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=DAILY;INTERVAL=2
"
"&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily"
"&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily")
(icalendar-testsuite--test-import
"SUMMARY:rrule daily with exceptions
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=DAILY;INTERVAL=2
EXDATE:20030921,20030925
"
"&%%(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"
"&%%(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")
(icalendar-testsuite--test-import
"SUMMARY:rrule weekly
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=WEEKLY;
"
"&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly"
"&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly")
(icalendar-testsuite--test-import
"SUMMARY:rrule monthly no end
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=MONTHLY;
"
"&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end"
"&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end")
(icalendar-testsuite--test-import
"SUMMARY:rrule monthly with end
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=MONTHLY;UNTIL=20050819;
"
"&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end"
"&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end")
(icalendar-testsuite--test-import
"DTSTART;VALUE=DATE:20040815
DTEND;VALUE=DATE:20040816
SUMMARY:Maria Himmelfahrt
UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
"
"&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt"
"&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt")
(icalendar-testsuite--test-import
"SUMMARY:rrule yearly
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=YEARLY;INTERVAL=2
"
"&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly" ;FIXME
"&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly") ;FIXME
(icalendar-testsuite--test-import
"SUMMARY:rrule count daily short
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
"
"&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short"
"&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short")
(icalendar-testsuite--test-import
"SUMMARY:rrule count daily long
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
"
"&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long"
"&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long")
(icalendar-testsuite--test-import
"SUMMARY:rrule count bi-weekly 3 times
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
"
"&%%(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"
"&%%(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")
(icalendar-testsuite--test-import
"SUMMARY:rrule count monthly
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
"
"&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly"
"&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly")
(icalendar-testsuite--test-import
"SUMMARY:rrule count every second month
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
"
"&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month" ;FIXME
"&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month") ;FIXME
(icalendar-testsuite--test-import
"SUMMARY:rrule count yearly
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
"
"&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly"
"&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly")
(icalendar-testsuite--test-import
"SUMMARY:rrule count every second year
DTSTART;VALUE=DATE-TIME:20030919T090000
DTEND;VALUE=DATE-TIME:20030919T113000
RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
"
"&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year" ;FIXME!!!
"&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year") ;FIXME!!!
;; duration
(icalendar-testsuite--test-import
"DTSTART;VALUE=DATE:20050217
SUMMARY:duration
DURATION:P7D
"
"&%%(and (diary-block 17 2 2005 23 2 2005)) duration"
"&%%(and (diary-block 2 17 2005 2 23 2005)) duration")
(icalendar-testsuite--test-import
"UID:20041127T183329Z-18215-1001-4536-49109@andromeda
DTSTAMP:20041127T183315Z
LAST-MODIFIED:20041127T183329
SUMMARY:Urlaub
DTSTART;VALUE=DATE:20011221
DTEND;VALUE=DATE:20011221
RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
CLASS:PUBLIC
SEQUENCE:1
CREATED:20041127T183329
"
"&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub"
"&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub")
)
;; ======================================================================
;; Export tests
;; ======================================================================
(defun icalendar-testsuite--run-export-tests ()
"Perform standard export tests."
(let ((icalendar-export-hidden-diary-entries nil))
(icalendar-testsuite--test-export
"&3 Okt 2000 ordinary no time "
"&Oct 3 2000 ordinary no time "
nil))
;; "ordinary" events
(icalendar-testsuite--test-export
"3 Okt 2000 ordinary no time "
"Oct 3 2000 ordinary no time "
"DTSTART;VALUE=DATE:20001003
DTEND;VALUE=DATE:20001004
SUMMARY:ordinary no time
")
(icalendar-testsuite--test-export
"3 Okt 2000 16:30 ordinary with time"
"Oct 3 2000 16:30 ordinary with time"
"DTSTART;VALUE=DATE-TIME:20001003T163000
DTEND;VALUE=DATE-TIME:20001003T173000
SUMMARY:ordinary with time
")
(icalendar-testsuite--test-export
"3 10 2000 16:30 ordinary with time 2"
"10 3 2000 16:30 ordinary with time 2"
"DTSTART;VALUE=DATE-TIME:20001003T163000
DTEND;VALUE=DATE-TIME:20001003T173000
SUMMARY:ordinary with time 2
")
(icalendar-testsuite--test-export
"3/10/2000 16:30 ordinary with time 3"
"10/3/2000 16:30 ordinary with time 3"
"DTSTART;VALUE=DATE-TIME:20001003T163000
DTEND;VALUE=DATE-TIME:20001003T173000
SUMMARY:ordinary with time 3
")