* macros.texi (Compiling Macros): Omit misleading sentence, which
[bpt/emacs.git] / test / icalendar-testsuite.el
index 8723321..e926eab 100644 (file)
@@ -1,6 +1,6 @@
 ;; icalendar-testsuite.el --- Test suite for icalendar.el
 
-;; Copyright (C) 2005, 2008  Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2008, 2009  Free Software Foundation, Inc.
 
 ;; Author:         Ulf Jasper <ulf.jasper@web.de>
 ;; Created:        March 2005
@@ -9,10 +9,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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.
+;; the Free Software Foundation, either version 3 of the License, 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
 ;; 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.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;; TODO:
 ;; - Add more unit tests for functions, timezone etc.
 
+;; Note: Watch the trailing blank that is added on import.
+
 ;;; Code:
 (defun icalendar-testsuite-run ()
   "Run icalendar test suite."
   (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))
+  (icalendar-testsuite--test-first-weekday-of-year)
+  (icalendar-testsuite--test-datestring-to-isodate)
+  (icalendar-testsuite--test-datetime-to-diary-date)
+  (icalendar-testsuite--test-diarytime-to-isotime)
+  (icalendar-testsuite--test-calendar-style)
+  (icalendar-testsuite--test-create-uid))
 
 (defun icalendar-testsuite--test-format-ical-event ()
-  "Test icalendar--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")
@@ -60,7 +65,6 @@
         (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
@@ -91,7 +95,7 @@ END:VEVENT
                      "-sum-des-loc-org-nil-nil-nil-") t)))
 
 (defun icalendar-testsuite--test-parse-summary-and-rest ()
-  "Test icalendar--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")
@@ -100,14 +104,12 @@ END:VEVENT
         (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 "))
+    (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 "))
+                  "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"))
@@ -121,7 +123,8 @@ END:VEVENT
     ))
 
 (defun icalendar-testsuite--get-ical-event (ical-string)
-  "Helper function for testing `icalendar-testsuite--test-format-ical-event'."
+  "Helper function for testing `icalendar-testsuite--test-format-ical-event'.
+Return icalendar event for ICAL-STRING."
   (save-excursion
     (with-temp-buffer
       (insert ical-string)
@@ -145,6 +148,7 @@ END:VEVENT
                            "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'"))))
 
 (defun icalendar-testsuite--test-first-weekday-of-year ()
+  "Test method for `icalendar-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)))
@@ -155,20 +159,147 @@ END:VEVENT
   (assert (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
   (assert (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
 
+(defun icalendar-testsuite--test-datestring-to-isodate ()
+  "Test method for `icalendar--datestring-to-isodate'."
+  (let ((calendar-date-style 'iso))
+    ;; numeric iso
+    (assert (string= (icalendar--datestring-to-isodate "2008 05 11")
+                     "20080511"))
+    (assert (string= (icalendar--datestring-to-isodate "2008 05 31")
+                     "20080531"))
+    (assert (string= (icalendar--datestring-to-isodate "2008 05 31" 2)
+                     "20080602"))
+
+    ;; numeric european
+    (setq calendar-date-style 'european)
+    (assert (string= (icalendar--datestring-to-isodate "11 05 2008")
+                     "20080511"))
+    (assert (string= (icalendar--datestring-to-isodate "31 05 2008")
+                     "20080531"))
+    (assert (string= (icalendar--datestring-to-isodate "31 05 2008" 2)
+                     "20080602"))
+
+    ;; numeric american
+    (setq calendar-date-style 'american)
+    (assert (string= (icalendar--datestring-to-isodate "11 05 2008")
+                     "20081105"))
+    (assert (string= (icalendar--datestring-to-isodate "12 30 2008")
+                     "20081230"))
+    (assert (string= (icalendar--datestring-to-isodate "12 30 2008" 2)
+                     "20090101"))
+
+    ;; non-numeric
+    (setq calendar-date-style nil)      ;not necessary for conversion
+    (assert (string= (icalendar--datestring-to-isodate "Nov 05 2008")
+                     "20081105"))
+    (assert (string= (icalendar--datestring-to-isodate "05 Nov 2008")
+                     "20081105"))
+    (assert (string= (icalendar--datestring-to-isodate "2008 Nov 05")
+                     "20081105"))))
+
+(defun icalendar-testsuite--test-datetime-to-diary-date ()
+  "Test method for `icalendar--datetime-to-diary-date'."
+  (let* ((datetime '(59 59 23 31 12 2008))
+         (calendar-date-style 'iso))
+    (assert (string= (icalendar--datetime-to-diary-date datetime)
+                     "2008 12 31"))
+    (setq calendar-date-style 'european)
+    (assert (string= (icalendar--datetime-to-diary-date datetime)
+                     "31 12 2008"))
+    (setq calendar-date-style 'american)
+    (assert (string= (icalendar--datetime-to-diary-date datetime)
+                     "12 31 2008"))))
+
+(defun icalendar-testsuite--test-diarytime-to-isotime ()
+  "Test method for `icalendar--diarytime-to-isotime'."
+  (assert (string= (icalendar--diarytime-to-isotime "0100" "")
+                   "T010000"))
+  (assert (string= (icalendar--diarytime-to-isotime "0100" "am")
+                   "T010000"))
+  (assert (string= (icalendar--diarytime-to-isotime "0100" "pm")
+                   "T130000"))
+  (assert (string= (icalendar--diarytime-to-isotime "1200" "")
+                   "T120000"))
+  (assert (string= (icalendar--diarytime-to-isotime "17:17" "")
+                   "T171700"))
+  (assert (string= (icalendar--diarytime-to-isotime "1200" "am")
+                   "T000000"))
+  (assert (string= (icalendar--diarytime-to-isotime "1201" "am")
+                   "T000100"))
+  (assert (string= (icalendar--diarytime-to-isotime "1259" "am")
+                   "T005900"))
+  (assert (string= (icalendar--diarytime-to-isotime "1200" "pm")
+                   "T120000"))
+  (assert (string= (icalendar--diarytime-to-isotime "1201" "pm")
+                   "T120100"))
+  (assert (string= (icalendar--diarytime-to-isotime "1259" "pm")
+                   "T125900")))
+
+(defun icalendar-testsuite--test-calendar-style ()
+  "Test method for `icalendar--date-style'."
+  (dolist (calendar-date-style '(iso american european))
+    (assert (eq (icalendar--date-style) calendar-date-style)))
+  (let ((cds calendar-date-style)
+        (european-calendar-style t))
+    (makunbound 'calendar-date-style)
+    (assert (eq (icalendar--date-style) 'european))
+    (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME
+    (assert (eq (icalendar--date-style) 'american))
+    (setq calendar-date-style cds)))
+
+(defun icalendar-testsuite--test-create-uid ()
+  "Test method for `icalendar--create-uid'."
+  (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s")
+         t-ct
+         (icalendar--uid-count 77)
+         (entry-full "30.06.1964 07:01 blahblah")
+         (hash (format "%d" (abs (sxhash entry-full))))
+         (contents "DTSTART:19640630T070100\nblahblah")
+         (username (or user-login-name "UNKNOWN_USER"))
+         )
+    ;; FIXME! If a test fails 'current-time is screwed. FIXME!
+    (fset 't-ct (symbol-function 'current-time))
+    (fset 'current-time (lambda () '(1 2 3)))
+    (assert (= 77 icalendar--uid-count))
+    (assert (string=  (concat "xxx-123-77-" hash "-" username "-19640630")
+                      (icalendar--create-uid entry-full contents)))
+    (assert (= 78 icalendar--uid-count))
+    (fset 'current-time (symbol-function 't-ct))
+
+    (setq contents "blahblah")
+    (setq icalendar-uid-format "yyy%syyy")
+    (assert (string=  (concat "yyyDTSTARTyyy")
+                      (icalendar--create-uid entry-full contents)))
+    ))
+
+
 ;; ======================================================================
 ;; Test methods for exporting from diary to icalendar
 ;; ======================================================================
 
-(defun icalendar-testsuite--test-export (input-european input-american
-                                                        expected-output)
+(defun icalendar-testsuite--test-export (input-iso input-european input-american
+                                                   expected-output)
   "Perform an export test.
+Argument INPUT-ISO iso style diary string.
 Argument INPUT-EUROPEAN european style diary string.
 Argument INPUT-AMERICAN american style diary string.
-Argument EXPECTED-OUTPUT expected icalendar result string."
+Argument EXPECTED-OUTPUT expected icalendar result string.
+
+European style input data must use german month names.  American
+and ISO style input data must use english month names."
   (message "--- icalendar-testsuite--test-export ---")
-  (let ((was-european-calendar european-calendar-style)
+  (let ((calendar-date-style 'iso)
         (icalendar-recurring-start-year 2000))
     (set-time-zone-rule "CET") ;;FIXME: reset timezone!
+    (when input-iso
+      (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"]))
+        (setq calendar-date-style 'iso)
+        (icalendar-testsuite--do-test-export input-iso expected-output)))
     (when input-european
       (let ((calendar-month-name-array
              ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
@@ -176,7 +307,7 @@ Argument EXPECTED-OUTPUT expected icalendar result string."
             (calendar-day-name-array
              ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
               "Samstag"]))
-        (european-calendar)
+        (setq calendar-date-style 'european)
         (icalendar-testsuite--do-test-export input-european expected-output)))
     (when input-american
       (let ((calendar-month-name-array
@@ -185,11 +316,8 @@ Argument EXPECTED-OUTPUT expected icalendar result string."
             (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))))
+        (setq calendar-date-style 'american)
+        (icalendar-testsuite--do-test-export input-american expected-output)))))
 
 (defun icalendar-testsuite--do-test-export (input expected-output)
   "Actually perform export test.
@@ -241,10 +369,11 @@ END:VCALENDAR
 ;; Test methods for importing from icalendar to diary
 ;; ======================================================================
 
-(defun icalendar-testsuite--test-import (input expected-european
+(defun icalendar-testsuite--test-import (input expected-iso expected-european
                                                expected-american)
   "Perform import test.
 Argument INPUT icalendar event string.
+Argument EXPECTED-ISO expected iso style diary string.
 Argument EXPECTED-EUROPEAN expected european style diary string.
 Argument EXPECTED-AMERICAN expected american style diary string."
   (message "--- icalendar-testsuite--test-import ---")
@@ -267,16 +396,16 @@ Argument EXPECTED-AMERICAN expected american style diary string."
             (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))
+            calendar-date-style)
+        (when expected-iso
+          (setq calendar-date-style 'iso)
+          (icalendar-testsuite--do-test-import input expected-iso))
         (when expected-european
-          (european-calendar)
+          (setq calendar-date-style 'european)
           (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))))
+          (setq calendar-date-style 'american)
+          (icalendar-testsuite--do-test-import input expected-american))))
     (set-time-zone-rule timezone)))
 
 (defun icalendar-testsuite--do-test-import (input expected-output)
@@ -317,15 +446,9 @@ Argument INPUT icalendar event string."
           (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)))))
+          (icalendar-import-format-class "\n Class: %s"))
+      (dolist (calendar-date-style '(iso european american))
+        (icalendar-testsuite--do-test-cycle)))))
 
 (defun icalendar-testsuite--do-test-cycle ()
   "Actually perform import/export cycle test."
@@ -362,12 +485,14 @@ Argument INPUT icalendar event string."
    "SUMMARY:non-recurring
 DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000"
+   "&2003/9/19 09:00-11:30 non-recurring"
    "&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"
+   "&2003/9/19 non-recurring allday"
    "&19/9/2003 non-recurring allday"
    "&9/19/2003 non-recurring allday")
 
@@ -375,6 +500,7 @@ DTSTART;VALUE=DATE-TIME:20030919"
    "SUMMARY:long 
  summary
 DTSTART;VALUE=DATE:20030919"
+   "&2003/9/19 long summary"
    "&19/9/2003 long summary"
    "&9/19/2003 long summary")
 
@@ -389,8 +515,10 @@ DTSTART;VALUE=DATE:20040719
 DTEND;VALUE=DATE:20040828
 DTSTAMP:20031103T011641Z
 "
+   "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien"
    "&%%(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
@@ -411,6 +539,7 @@ DTSTAMP
 LAST-MODIFIED
  :20041118T013640Z
 "
+   "&2004/11/23 14:00-14:30 folded summary"
    "&23/11/2004 14:00-14:30 folded summary"
    "&11/23/2004 14:00-14:30 folded summary")
   (icalendar-testsuite--test-import
@@ -431,14 +560,17 @@ DTEND
 DTSTAMP
  :20041118T013641Z
 "
+   "&2004/11/23 14:45-15:45 another example"
    "&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 2003 9 19)) 09:00-11:30 rrule 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")
 
@@ -449,6 +581,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=DAILY;INTERVAL=2
 "
+   "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily"
    "&%%(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
@@ -458,14 +591,17 @@ DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=DAILY;INTERVAL=2
 EXDATE:20030921,20030925
 "
+   "&%%(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"
    "&%%(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 2003 9 19)) 09:00-11:30 rrule 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
@@ -474,6 +610,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=MONTHLY;
 "
+   "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end"
    "&%%(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
@@ -482,6 +619,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=MONTHLY;UNTIL=20050819;
 "
+   "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end"
    "&%%(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
@@ -491,6 +629,7 @@ SUMMARY:Maria Himmelfahrt
 UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
 "
+   "&%%(and (diary-anniversary 2004 8 15))  Maria Himmelfahrt"
    "&%%(and (diary-anniversary 15 8 2004))  Maria Himmelfahrt"
    "&%%(and (diary-anniversary 8 15 2004))  Maria Himmelfahrt")
   (icalendar-testsuite--test-import
@@ -499,6 +638,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=YEARLY;INTERVAL=2
 "
+   "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly" ;FIXME
    "&%%(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
@@ -507,6 +647,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
 "
+   "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short"
    "&%%(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
@@ -515,6 +656,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
 "
+   "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long"
    "&%%(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
@@ -523,6 +665,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
 "
+   "&%%(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"
    "&%%(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
@@ -531,6 +674,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
 "
+   "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly"
    "&%%(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
@@ -539,6 +683,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
 "
+   "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month" ;FIXME
    "&%%(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
@@ -547,6 +692,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
 "
+   "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly"
    "&%%(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
@@ -555,6 +701,7 @@ DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
 "
+   "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year" ;FIXME!!!
    "&%%(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!!!
 
@@ -564,6 +711,7 @@ RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
 SUMMARY:duration
 DURATION:P7D
 "
+   "&%%(and (diary-block 2005 2 17 2005 2 23)) duration"
    "&%%(and (diary-block 17 2 2005 23 2 2005)) duration"
    "&%%(and (diary-block 2 17 2005 2 23 2005)) duration")
 
@@ -579,6 +727,7 @@ CLASS:PUBLIC
 SEQUENCE:1
 CREATED:20041127T183329
 "
+   "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29))  Urlaub"
    "&%%(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")
   )
@@ -591,19 +740,22 @@ CREATED:20041127T183329
 
   (let ((icalendar-export-hidden-diary-entries nil))
     (icalendar-testsuite--test-export
+     "&2000 Oct 3 ordinary no time "
      "&3 Okt 2000 ordinary no time "
      "&Oct 3 2000 ordinary no time "
      nil))
 
   ;; "ordinary" events
   (icalendar-testsuite--test-export
+   "2000 Oct 3 ordinary no time "
    "3 Okt 2000 ordinary no time "
    "Oct 3 2000 ordinary no time "
    "DTSTART;VALUE=DATE:20001003
 DTEND;VALUE=DATE:20001004
-SUMMARY:ordinary no time 
+SUMMARY:ordinary no time
 ")
   (icalendar-testsuite--test-export
+   "2000 Oct 3 16:30 ordinary with time"
    "3 Okt 2000 16:30 ordinary with time"
    "Oct 3 2000 16:30 ordinary with time"
    "DTSTART;VALUE=DATE-TIME:20001003T163000
@@ -611,6 +763,7 @@ DTEND;VALUE=DATE-TIME:20001003T173000
 SUMMARY:ordinary with time
 ")
   (icalendar-testsuite--test-export
+   "2000 10 3 16:30 ordinary with time 2"
    "3 10 2000 16:30 ordinary with time 2"
    "10 3 2000 16:30 ordinary with time 2"
    "DTSTART;VALUE=DATE-TIME:20001003T163000
@@ -619,6 +772,7 @@ SUMMARY:ordinary with time 2
 ")
 
   (icalendar-testsuite--test-export
+   "2000/10/3 16:30 ordinary with time 3"
    "3/10/2000 16:30 ordinary with time 3"
    "10/3/2000 16:30 ordinary with time 3"
    "DTSTART;VALUE=DATE-TIME:20001003T163000
@@ -628,6 +782,8 @@ SUMMARY:ordinary with time 3
 
   ;; multiline -- FIXME!!!
   (icalendar-testsuite--test-export
+   "2000 October 3 16:30 multiline
+  17:30 multiline continued FIXME"
    "3 Oktober 2000 16:30 multiline
   17:30 multiline continued FIXME"
    "October 3 2000 16:30 multiline
@@ -641,6 +797,7 @@ DESCRIPTION:
 
   ;; weekly by day
   (icalendar-testsuite--test-export
+   "Monday 1:30pm weekly by day with start time"
    "Montag 13:30 weekly by day with start time"
    "Monday 1:30pm weekly by day with start time"
    "DTSTART;VALUE=DATE-TIME:20000103T133000
@@ -650,6 +807,7 @@ SUMMARY:weekly by day with start time
 ")
 
   (icalendar-testsuite--test-export
+   "Monday 13:30-15:00 weekly by day with start and end time"
    "Montag 13:30-15:00 weekly by day with start and end time"
    "Monday 01:30pm-03:00pm weekly by day with start and end time"
    "DTSTART;VALUE=DATE-TIME:20000103T133000
@@ -660,6 +818,7 @@ SUMMARY:weekly by day with start and end time
 
   ;; yearly
   (icalendar-testsuite--test-export
+   "may 1 yearly no time"
    "1 Mai yearly no time"
    "may 1 yearly no time"
    "DTSTART;VALUE=DATE:19000501
@@ -670,6 +829,7 @@ SUMMARY:yearly no time
 
   ;; anniversaries
   (icalendar-testsuite--test-export
+   "%%(diary-anniversary 1989 10 3) anniversary no time"
    "%%(diary-anniversary 3 10 1989) anniversary no time"
    "%%(diary-anniversary 10 3 1989) anniversary no time"
    "DTSTART;VALUE=DATE:19891003
@@ -678,6 +838,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
 SUMMARY:anniversary no time
 ")
   (icalendar-testsuite--test-export
+   "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
    "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
    "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
    "DTSTART;VALUE=DATE-TIME:19891003T190000
@@ -688,6 +849,7 @@ SUMMARY:anniversary with time
 
   ;; block
   (icalendar-testsuite--test-export
+   "%%(diary-block 2001 6 18 2001 7 6) block no time"
    "%%(diary-block 18 6 2001 6 7 2001) block no time"
    "%%(diary-block 6 18 2001 7 6 2001) block no time"
    "DTSTART;VALUE=DATE:20010618
@@ -695,6 +857,7 @@ DTEND;VALUE=DATE:20010707
 SUMMARY:block no time
 ")
   (icalendar-testsuite--test-export
+   "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
    "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
    "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
    "DTSTART;VALUE=DATE-TIME:20010618T130000
@@ -703,6 +866,7 @@ RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
 SUMMARY:block with time
 ")
   (icalendar-testsuite--test-export
+   "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
    "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
    "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
    "DTSTART;VALUE=DATE-TIME:20010618T130000
@@ -773,6 +937,7 @@ TRIGGER;RELATED=START:-PT00H15M00S
 END:VALARM
 END:VEVENT
 END:VCALENDAR"
+   nil
    "&9/5/2003 10:30-15:30 On-Site Interview
  Desc: 10:30am - Blah
  Location: Cccc
@@ -814,6 +979,7 @@ ACTION:DISPLAY
 DESCRIPTION:REMINDER
 TRIGGER;RELATED=START:-PT00H15M00S
 END:VALARM"
+   nil
    "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
  Desc: 753 Zeichen hier radiert
  Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
@@ -880,6 +1046,7 @@ TRIGGER;RELATED=START:-PT00H15M00S
 END:VALARM
 END:VEVENT
 END:VCALENDAR"
+   nil
    "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
  Desc: Viele Zeichen standen hier früher
  Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
@@ -893,6 +1060,7 @@ END:VCALENDAR"
 
   ;; export 2004-10-28 block entries
   (icalendar-testsuite--test-export
+   nil
    nil
    "-*- mode: text; fill-column: 256;-*-
 
@@ -905,6 +1073,7 @@ DTEND;VALUE=DATE:20041111
 SUMMARY:Nov 8-10 aa")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
    "DTSTART;VALUE=DATE:20041213
@@ -912,6 +1081,7 @@ DTEND;VALUE=DATE:20041218
 SUMMARY:Dec 13-17 bb")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
    "DTSTART;VALUE=DATE:20050203
@@ -919,6 +1089,7 @@ DTEND;VALUE=DATE:20050205
 SUMMARY:Feb 3-4 cc")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
    "DTSTART;VALUE=DATE:20050424
@@ -926,6 +1097,7 @@ DTEND;VALUE=DATE:20050430
 SUMMARY:April 24-29 dd
 ")
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
    "DTSTART;VALUE=DATE:20050530
@@ -933,6 +1105,7 @@ DTEND;VALUE=DATE:20050602
 SUMMARY:may 30 - June 1: ee")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-block 6 6 2005 6 8 2005) ff"
    "DTSTART;VALUE=DATE:20050606
@@ -941,6 +1114,7 @@ SUMMARY:ff")
 
   ;; export 2004-10-28 anniversary entries
   (icalendar-testsuite--test-export
+   nil
    nil
    "
 >>> anniversaries:
@@ -953,6 +1127,7 @@ SUMMARY:aa birthday (%d years old)
 ")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
    "DTSTART;VALUE=DATE:19570517
@@ -961,6 +1136,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
 SUMMARY:bb birthday (%d years old)")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
    "DTSTART;VALUE=DATE:19970608
@@ -969,6 +1145,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
 SUMMARY:cc birthday (%d years old)")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
    "DTSTART;VALUE=DATE:19830722
@@ -977,6 +1154,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
 SUMMARY:dd (%d years ago...!)")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
    "DTSTART;VALUE=DATE:19880801
@@ -985,6 +1163,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
 SUMMARY:ee birthday (%d years old)")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
    "DTSTART;VALUE=DATE:19570921
@@ -1006,6 +1185,7 @@ SUMMARY:ff birthday (%d years old)")
   ;; "xxx")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    ">>> ------------ my week:
 
@@ -1016,6 +1196,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
 SUMMARY:MAC")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "Monday 15:00 a1"
    "DTSTART;VALUE=DATE-TIME:20000103T150000
@@ -1025,6 +1206,7 @@ SUMMARY:a1")
 
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "Monday 16:00-17:00 a2"
    "DTSTART;VALUE=DATE-TIME:20000103T160000
@@ -1033,6 +1215,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
 SUMMARY:a2")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "Tuesday 11:30-13:00 a3"
    "DTSTART;VALUE=DATE-TIME:20000104T113000
@@ -1041,6 +1224,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
 SUMMARY:a3")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "Tuesday 15:00 a4"
    "DTSTART;VALUE=DATE-TIME:20000104T150000
@@ -1049,6 +1233,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
 SUMMARY:a4")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "Wednesday 13:00 a5"
    "DTSTART;VALUE=DATE-TIME:20000105T130000
@@ -1057,6 +1242,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
 SUMMARY:a5")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "Wednesday 11:30-13:30 a6"
    "DTSTART;VALUE=DATE-TIME:20000105T113000
@@ -1065,6 +1251,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
 SUMMARY:a6")
 
   (icalendar-testsuite--test-export
+   nil
    nil
    "Wednesday 15:00 s1"
    "DTSTART;VALUE=DATE-TIME:20000105T150000
@@ -1075,6 +1262,7 @@ SUMMARY:s1")
 
   ;; export 2004-10-28 regular entries
   (icalendar-testsuite--test-export
+   nil
    nil
    "
 >>> regular diary entries:
@@ -1219,6 +1407,7 @@ LAST-MODIFIED
 END:VEVENT
 END:VCALENDAR
 "
+   nil
    "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
  Status: TENTATIVE
  Class: PRIVATE 
@@ -1262,12 +1451,14 @@ END:VCALENDAR
   (icalendar-testsuite--test-export
    "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
    nil
+   nil
    "DTSTART;VALUE=DATE:20040101
 DTEND;VALUE=DATE:20040105
 SUMMARY:Urlaub")
 
   ;; 2004-10-25 pg
   (icalendar-testsuite--test-export
+   nil
    "5 11 2004 Bla Fasel"
    nil
    "DTSTART;VALUE=DATE:20041105
@@ -1276,6 +1467,7 @@ SUMMARY:Bla Fasel")
 
   ;; 2004-10-30 pg
   (icalendar-testsuite--test-export
+   nil
    "2 Nov 2004 15:00-16:30 Zahnarzt"
    nil
    "DTSTART;VALUE=DATE-TIME:20041102T150000
@@ -1304,6 +1496,7 @@ DTEND
  :20050207
 DTSTAMP
  :20050128T011209Z"
+   nil
    "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
  Desc: abcdef"
    "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
@@ -1316,11 +1509,13 @@ SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
 UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
 DTSTAMP:20050118T210335Z
 DURATION:P7D"
+   nil
    "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa"
    "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa")
 
   ;; 2005-03-23 lt
   (icalendar-testsuite--test-export
+   nil
    "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
    nil
    "DTSTART;VALUE=DATE-TIME:20050208T160000
@@ -1331,6 +1526,7 @@ SUMMARY:[WORK] Pppp
 
   ;; 2005-05-27 eu
   (icalendar-testsuite--test-export
+   nil
    nil
    ;; FIXME: colon not allowed!
    ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
@@ -1343,6 +1539,7 @@ SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
   )
 
 (defun icalendar-testsuite--run-cycle-tests ()
+  "Perform cycling tests."
   (icalendar-testsuite--test-cycle
    "DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000