From 55d7c18787360f934f5afa63d9361ac36319c6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 3 Apr 2019 22:51:50 +0200 Subject: Move examples from recurrence internal to tests. --- tests/rrule-parse.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/rrule-parse.scm (limited to 'tests/rrule-parse.scm') diff --git a/tests/rrule-parse.scm b/tests/rrule-parse.scm new file mode 100644 index 00000000..b3bbe770 --- /dev/null +++ b/tests/rrule-parse.scm @@ -0,0 +1,35 @@ +(test-begin "RRULE parse") + +(use-modules (vcalendar recurrence parse)) + +(define-syntax mkrule + (syntax-rules () + ((_ (key val) ...) + ((record-constructor (@@ (vcalendar recurrence internal) ) + (quote (key ...))) + (quote val) ...)))) + +(test-equal (mkrule (freq HOURLY) (wkst MO) (interval 1)) + (parse-recurrence-rule "FREQ=HOURLY")) + +(test-equal (mkrule (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 +;; => #< freq: #< 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 + +(parse-recurrence-rule "FREQ=HOURLY;COUNT=err") +;; => #< 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 +;; => #< freq: HOURLY until: #f count: #< 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 + +(test-end "RRULE parse") -- cgit v1.2.3