Fix period tests with error reporting.

This commit is contained in:
Dominik Pantůček 2023-03-20 20:53:02 +01:00
parent 4b26c653d9
commit 019136319f

View file

@ -75,7 +75,9 @@
(rmt (if cb 'stop 'start)) (rmt (if cb 'stop 'start))
(mtype (car marker)) (mtype (car marker))
(month (cadr marker)) (month (cadr marker))
(line-number (caddr marker))) (line-number (if (null? (cddr marker))
#f
(caddr marker))))
(if (eq? mtype rmt) (if (eq? mtype rmt)
(if cb (if cb
(loop (cdr l) (loop (cdr l)
@ -161,14 +163,20 @@
(test-equal? period-markers->periods (test-equal? period-markers->periods
(period-markers->periods (period-markers->periods
'((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4)))) '((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4))))
'(((2022 3) . (2022 10)) '(#t
((2023 1) . (2023 4)))) (((2022 3) . (2022 10))
((2023 1) . (2023 4)))
""
-1))
(test-equal? period-markers->periods-open (test-equal? period-markers->periods-open
(period-markers->periods (period-markers->periods
'((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4)) (start (2023 5)))) '((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4)) (start (2023 5))))
'(((2022 3) . (2022 10)) '(#t
((2023 1) . (2023 4)) (((2022 3) . (2022 10))
((2023 5) . #f))) ((2023 1) . (2023 4))
((2023 5) . #f))
""
-1))
(test-eq? period-duration (test-eq? period-duration
(period->duration '((2023 1) . (2023 4))) 3) (period->duration '((2023 1) . (2023 4))) 3)
(parameterize ((*current-month* (list 2023 4))) (parameterize ((*current-month* (list 2023 4)))