aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-05-24 22:29:19 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-05-24 22:29:19 +0200
commit418a86f235f90aa05aa5050e4f2fc44cd9d6721a (patch)
tree55fcf6532297feeb1213da3d45ebaccf6e37fc61 /tests
parentIntroduce warnings-are-errors parameter. (diff)
downloadcalp-418a86f235f90aa05aa5050e4f2fc44cd9d6721a.tar.gz
calp-418a86f235f90aa05aa5050e4f2fc44cd9d6721a.tar.xz
Catch warnings in tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/datetime-compare.scm1
-rw-r--r--tests/rrule-parse.scm18
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/datetime-compare.scm b/tests/datetime-compare.scm
index cd077e87..649dc59f 100644
--- a/tests/datetime-compare.scm
+++ b/tests/datetime-compare.scm
@@ -75,3 +75,4 @@
(test-assert (not (date/-time< #2018-11-30T08:10:00 #2014-04-13T16:00:00)))
+
diff --git a/tests/rrule-parse.scm b/tests/rrule-parse.scm
index 3ecfc693..12ba93fd 100644
--- a/tests/rrule-parse.scm
+++ b/tests/rrule-parse.scm
@@ -1,7 +1,9 @@
(((vcomponent recurrence parse)
parse-recurrence-rule)
((vcomponent recurrence) make-recur-rule)
- ((datetime util) mon))
+ ((datetime util) mon)
+ ((util exceptions) warnings-are-errors warning-handler)
+ )
(test-equal (make-recur-rule freq: 'HOURLY wkst: mon interval: 1)
(parse-recurrence-rule "FREQ=HOURLY"))
@@ -11,17 +13,25 @@
;;; TODO write tests for these cases
-(parse-recurrence-rule "FREQ=ERR;COUNT=3")
+(parameterize ((warnings-are-errors #t)
+ (warning-handler identity)) ; silence warnings
+ (test-error "Invalid FREQ" 'warning
+ (parse-recurrence-rule "FREQ=ERR;COUNT=3"))
+
+ (test-error "Negative COUNT" 'warning
+ (parse-recurrence-rule "FREQ=HOURLY;COUNT=-1"))
+
+ (test-error "Invalid COUNT"
+ 'wrong-type-argument
+ (parse-recurrence-rule "FREQ=HOURLY;COUNT=err")) )
; 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