diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-27 21:29:47 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-11-06 00:46:25 +0100 |
commit | ad99ea49de2bda94f1f6af1c14b61401c1696f9d (patch) | |
tree | 4c50a7ccbe52a066586842436908e0409994eab3 /tests/unit/vcomponent | |
parent | Group tests/recurrence-simple to avoid warnings. (diff) | |
download | calp-ad99ea49de2bda94f1f6af1c14b61401c1696f9d.tar.gz calp-ad99ea49de2bda94f1f6af1c14b61401c1696f9d.tar.xz |
Tests.
Diffstat (limited to 'tests/unit/vcomponent')
-rw-r--r-- | tests/unit/vcomponent/create.scm | 31 | ||||
-rw-r--r-- | tests/unit/vcomponent/geo.scm | 12 | ||||
-rw-r--r-- | tests/unit/vcomponent/vcomponent-datetime.scm | 16 | ||||
-rw-r--r-- | tests/unit/vcomponent/vcomponent.scm | 11 |
4 files changed, 58 insertions, 12 deletions
diff --git a/tests/unit/vcomponent/create.scm b/tests/unit/vcomponent/create.scm index caf2d33c..537ccbe9 100644 --- a/tests/unit/vcomponent/create.scm +++ b/tests/unit/vcomponent/create.scm @@ -2,12 +2,24 @@ :use-module ((srfi srfi-1) :select (every)) :use-module (srfi srfi-64) :use-module (srfi srfi-88) + :use-module ((vcomponent base) :select (vcomponent?)) :use-module ((vcomponent create) :select (vcomponent with-parameters - as-list)) + + as-list + vcalendar + vevent + vtimezone + standard + daylight)) :use-module ((vcomponent) - :select (children properties type prop prop* param vline?))) + :select (children + properties + type + prop prop* + param + vline?))) ;; vevent, vcalendar, vtimezone, standard, and daylight all trivial ;; and therefore not tested @@ -66,4 +78,19 @@ ;; (test-group "Parameters and lists" ) +(test-assert (vcomponent? (vcalendar))) +(test-eq 'VCALENDAR (type (vcalendar))) + +(test-assert (vcomponent? (vevent))) +(test-eq 'VEVENT (type (vevent))) + +(test-assert (vcomponent? (vtimezone))) +(test-eq 'VTIMEZONE (type (vtimezone))) + +(test-assert (vcomponent? (standard))) +(test-eq 'STANDARD (type (standard))) + +(test-assert (vcomponent? (daylight))) +(test-eq 'DAYLIGHT (type (daylight))) + '((vcomponent create)) diff --git a/tests/unit/vcomponent/geo.scm b/tests/unit/vcomponent/geo.scm new file mode 100644 index 00000000..2cc8ab28 --- /dev/null +++ b/tests/unit/vcomponent/geo.scm @@ -0,0 +1,12 @@ +(define-module (test geo) + :use-module (srfi srfi-64) + :use-module (srfi srfi-64 test-error) + :use-module (srfi srfi-71) + :use-module (srfi srfi-88) + :use-module (vcomponent geo)) + +(test-assert (geo? (geo x: 10 y: 20))) +(test-error 'wrong-type-arg + (geo)) + +'((vcomponent geo)) diff --git a/tests/unit/vcomponent/vcomponent-datetime.scm b/tests/unit/vcomponent/vcomponent-datetime.scm index 80fee259..18616bb4 100644 --- a/tests/unit/vcomponent/vcomponent-datetime.scm +++ b/tests/unit/vcomponent/vcomponent-datetime.scm @@ -12,8 +12,8 @@ (define ev (vevent - dtstart: (datetime year: 2020 month: 03 day: 29 hour: 17 minute: 00 second: 00) - dtend: (datetime year: 2020 month: 04 day: 01 hour: 10 minute: 00 second: 00))) + dtstart: (datetime year: 2020 month: 3 day: 29 hour: 17) + dtend: (datetime year: 2020 month: 4 day: 1 hour: 10))) ;; |-----------------| test interval @@ -23,21 +23,21 @@ "Correct clamping" (datetime time: (time hour: 7)) ; 2020-03-29T17:00 - 2020-03-30T00:00 (event-length/clamped - (date year: 2020 month: 03 day: 23) ; a time way before the start of the event - (date year: 2020 month: 03 day: 29) ; a time slightly after the end of the event + (date year: 2020 month: 3 day: 23) ; a time way before the start of the event + (date year: 2020 month: 3 day: 29) ; a time slightly after the end of the event ev)) (define utc-ev (vevent - dtstart: (datetime year: 2020 month: 03 day: 29 hour: 15 minute: 00 second: 00 tz: "UTC") - dtend: (datetime year: 2020 month: 04 day: 01 hour: 08 minute: 00 second: 00 tz: "UTC"))) + dtstart: (datetime year: 2020 month: 3 day: 29 hour: 15 tz: "UTC") + dtend: (datetime year: 2020 month: 4 day: 1 hour: 8 tz: "UTC"))) (test-equal "Correct clamping UTC" (datetime time: (time hour: 7)) (event-length/clamped - (date year: 2020 month: 03 day: 23) - (date year: 2020 month: 03 day: 29) + (date year: 2020 month: 3 day: 23) + (date year: 2020 month: 3 day: 29) ev)) diff --git a/tests/unit/vcomponent/vcomponent.scm b/tests/unit/vcomponent/vcomponent.scm index 7a9ce96a..2f692d19 100644 --- a/tests/unit/vcomponent/vcomponent.scm +++ b/tests/unit/vcomponent/vcomponent.scm @@ -135,7 +135,14 @@ ;; parameters ;; properties -;; x-property? -;; internal-field? +(test-group "x-property?" + (test-assert (x-property? 'X-Extension)) + (test-assert (not (x-property? 'Regular))) + (test-assert (not (x-property? '-internal)))) + +(test-group "internal-field?" + (test-assert (not (internal-field? 'X-Extension))) + (test-assert (not (internal-field? 'Regular))) + (test-assert (internal-field? '-internal))) '((vcomponent base)) |