aboutsummaryrefslogtreecommitdiff
path: root/test.scm
blob: eaf5e311c837131c274aeddf74d8a4fb3a4fa666 (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
#!/usr/bin/guile -s
!#

(add-to-load-path (dirname (current-filename)))

(use-modules (rnrs base)                ; assert
             (srfi srfi-1)
             (srfi srfi-19)
             (srfi srfi-19 util)
             (srfi srfi-41)
             (code)
             (vcalendar)
             (vcalendar recur))

(define cal (make-vcomponent "testcal/repeating-event.ics"))

(define ev (find (lambda (ev) (eq? 'VEVENT (type ev)))
                 (children cal)))

(define ev-copy (copy-vcomponent ev))

(assert (equal? (children ev)
                (children ev-copy)))

(define strm (recur-event ev))

(stream-for-each
 (lambda (ev)
   (format #t "~a -- ~a~%"
           (time->string (attr ev "DTSTART") "~1 ~3")
           (time->string (attr ev "DTEND") "~1 ~3")))
 (stream-take 10 (recur-event ev)))

(newline)

(for-each
 (lambda (ev)
   (format #t "~a -- ~a~%"
           (time->string (attr ev "DTSTART") "~1 ~3")
           (time->string (attr ev "DTEND") "~1 ~3")))
 (stream->list (stream-take 20 (recur-event ev))))