changeset 99286:34d4bb11f58f

icalendar: uid-creation improved
author Ulf Jasper <ulf.jasper@web.de>
date Fri, 31 Oct 2008 18:48:23 +0000
parents 26e573b758f1
children 80eabff1490b
files test/ChangeLog test/icalendar-testsuite.el
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/ChangeLog	Fri Oct 31 18:28:16 2008 +0000
+++ b/test/ChangeLog	Fri Oct 31 18:48:23 2008 +0000
@@ -1,3 +1,9 @@
+2008-10-31  Ulf Jasper  <ulf@web.de>
+
+	* icalendar-testsuite.el (icalendar-testsuite--run-function-tests):
+	Added `icalendar-testsuite--test-create-uid'.
+	(icalendar-testsuite--test-create-uid): New.
+
 2008-06-14  Ulf Jasper  <ulf.jasper@web.de>
 
 	* newsticker-testsuite.el: New file.
--- a/test/icalendar-testsuite.el	Fri Oct 31 18:28:16 2008 +0000
+++ b/test/icalendar-testsuite.el	Fri Oct 31 18:48:23 2008 +0000
@@ -51,7 +51,8 @@
   (icalendar-testsuite--test-first-weekday-of-year)
   (icalendar-testsuite--test-datestring-to-isodate)
   (icalendar-testsuite--test-datetime-to-diary-date)
-  (icalendar-testsuite--test-calendar-style))
+  (icalendar-testsuite--test-calendar-style)
+  (icalendar-testsuite--test-create-uid))
 
 (defun icalendar-testsuite--test-format-ical-event ()
   "Test `icalendar--format-ical-event'."
@@ -221,6 +222,19 @@
     (assert (eq (icalendar--date-style) 'american))
     (setq calendar-date-style cds)))
 
+(defun icalendar-testsuite--test-create-uid ()
+  "Test method for `icalendar--create-uid'."
+  (let (t-ct
+        (icalendar--uid-count 77))
+    ;; 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=  "emacs12378" (icalendar--create-uid)))
+    (assert (= 78 icalendar--uid-count))
+    (fset 'current-time (symbol-function 't-ct))
+    ))
+
 ;; ======================================================================
 ;; Test methods for exporting from diary to icalendar
 ;; ======================================================================