aboutsummaryrefslogtreecommitdiff
path: root/tests/recurrence-id.scm
blob: be58d9244e10968f0580f13545054f72d7a968be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;;; Commentary:
;; Tests that exceptions (in the recurrence-id meaning) 
;; in recurrence sets are handled correctly.
;; TODO Is however far from done.
;;; Code:

(((srfi srfi-41) stream->list)
 ((vcomponent) parse-calendar)
 ((vcomponent recurrence) generate-recurrence-set)
 ((guile) format)
 )

(define uid (symbol->string (gensym "areallyuniqueid")))

;; TODO standardize vcomponents for tests as xcal, for example:
`(vcalendar
   (children
     (vevent
       (properties
         (summary (text "Changing type on Recurrence-id."))
         (uid (text ,uid))
         (dtstart (date "20090127"))))
     (vevent
       (properties
         (summary (text "Changing type on Recurrence-id."))
         (uid (text ,uid))
         (dtstart (params (TZID "Europe/Stockholm")) 
                  (date-time "20100127T120000"))
         (recurrence-id (date "20100127"))
         (summary "This instance only has a time component")))))

(define ev
 (call-with-input-string
     (format #f "BEGIN:VCALENDAR
BEGIN:VEVENT
SUMMARY:Changing type on Recurrence-id.
UID:~a
DTSTART;VALUE=DATE:20090127
END:VEVENT
BEGIN:VEVENT
UID:~a
SUMMARY:Changing type on Recurrence-id.
DTSTART;TZID=Europe/Stockholm:20100127T120000
RECURRENCE-ID;VALUE=DATE:20100127
SUMMARY:This instance only has a time component
END:VEVENT
END:VCALENDAR"
             uid uid)
   parse-calendar))


(test-assert "Changing type on Recurrence id."
  (stream->list 10 (generate-recurrence-set ev)))