diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-24 22:29:19 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-24 22:29:19 +0200 |
commit | 418a86f235f90aa05aa5050e4f2fc44cd9d6721a (patch) | |
tree | 55fcf6532297feeb1213da3d45ebaccf6e37fc61 /tests/rrule-parse.scm | |
parent | Introduce warnings-are-errors parameter. (diff) | |
download | calp-418a86f235f90aa05aa5050e4f2fc44cd9d6721a.tar.gz calp-418a86f235f90aa05aa5050e4f2fc44cd9d6721a.tar.xz |
Catch warnings in tests.
Diffstat (limited to 'tests/rrule-parse.scm')
-rw-r--r-- | tests/rrule-parse.scm | 18 |
1 files changed, 14 insertions, 4 deletions
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 |