aboutsummaryrefslogtreecommitdiff
path: root/tests/rrule-parse.scm
blob: d7733310c0d4a5dabfa7cfa6009f68f10eac14a2 (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
(((vcomponent recurrence parse)
  parse-recurrence-rule)
 ((vcomponent recurrence) make-recur-rule))

(test-equal (make-recur-rule (freq 'HOURLY) (wkst 'MO) (interval 1))
  (parse-recurrence-rule "FREQ=HOURLY"))

(test-equal (make-recur-rule (freq 'HOURLY) (count 3) (interval 1) (wkst 'MO))
    (parse-recurrence-rule "FREQ=HOURLY;COUNT=3"))

;;; TODO write tests for these cases

(parse-recurrence-rule "FREQ=ERR;COUNT=3")
                                        ; TODO this error seems to have an error
;; => #<<recur-rule> freq: #<<recur-rule> freq: #f until: #f count: #f interval: 1 bysecond: #f byminute: #f byhour: #f byday: #f bymonthday: #f byyearday: #f byweekno: #f bymonth: #f bysetpos: #f wkst: MO> until: #f count: 3 interval: 1 bysecond: #f byminute: #f byhour: #f byday: #f bymonthday: #f byyearday: #f byweekno: #f bymonth: #f bysetpos: #f wkst: MO>
;; ERR unfulfilled-constraint [ERR] doesn't fulfill constraint of type [FREQ], ignoring

(test-error 'wrong-type-argument (parse-recurrence-rule "FREQ=HOURLY;COUNT=err"))
;; => #<<recur-rule> freq: HOURLY until: #f count: #f interval: 1
;;    bysecond: #f byminute: #f byhour: #f byday: #f bymonthday: #f
;;    byyearday: #f byweekno: #f bymonth: #f bysetpos: #f wkst: MO>
;; ERR invalid-value [#f] for key [COUNT], ignoring.

(parse-recurrence-rule "FREQ=HOURLY;COUNT=-1") ; TODO this error seems to have an error
;; => #<<recur-rule> freq: HOURLY until: #f count: #<<recur-rule> freq: HOURLY until: #f count: #f interval: 1 bysecond: #f byminute: #f byhour: #f byday: #f bymonthday: #f byyearday: #f byweekno: #f bymonth: #f bysetpos: #f wkst: MO> interval: 1 bysecond: #f byminute: #f byhour: #f byday: #f bymonthday: #f byyearday: #f byweekno: #f bymonth: #f bysetpos: #f wkst: MO>
;; ERR unfulfilled-constraint [-1] doesn't fulfill constraint of type [COUNT], ignoring