diff options
Diffstat (limited to 'tests/formats')
-rw-r--r-- | tests/formats/README.md | 9 | ||||
-rw-r--r-- | tests/formats/event.ics | 27 | ||||
-rw-r--r-- | tests/formats/event.xcs | 50 | ||||
-rw-r--r-- | tests/formats/ical.scm | 24 | ||||
-rwxr-xr-x | tests/formats/test.scm | 102 | ||||
-rw-r--r-- | tests/formats/xcal.scm | 26 |
6 files changed, 0 insertions, 238 deletions
diff --git a/tests/formats/README.md b/tests/formats/README.md deleted file mode 100644 index b17bd866..00000000 --- a/tests/formats/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Serialization and deserialization formats -========================================= - -`test.scm` runs every other test. - -xcal ----- - -The program handles xml trees with a default namespace fine, but diff does not. diff --git a/tests/formats/event.ics b/tests/formats/event.ics deleted file mode 100644 index 5b578627..00000000 --- a/tests/formats/event.ics +++ /dev/null @@ -1,27 +0,0 @@ -BEGIN:VCALENDAR
-PRODID:-//PIMUTILS.ORG//NONSGML khal / icalendar //EN
-VERSION:2.0
-BEGIN:VTIMEZONE
-TZID:Europe/Stockholm
-BEGIN:DAYLIGHT
-DTSTART;VALUE=DATE-TIME:20180325T030000
-TZNAME:CEST
-TZOFFSETFROM:+0100
-TZOFFSETTO:+0200
-END:DAYLIGHT
-BEGIN:STANDARD
-DTSTART;VALUE=DATE-TIME:20181028T020000
-TZNAME:CET
-TZOFFSETFROM:+0200
-TZOFFSETTO:+0100
-END:STANDARD
-END:VTIMEZONE
-BEGIN:VEVENT
-DTEND;TZID=Europe/Stockholm;VALUE=DATE-TIME:20180907T180000
-DTSTAMP;VALUE=DATE-TIME:20180907T154223Z
-DTSTART;TZID=Europe/Stockholm;VALUE=DATE-TIME:20180907T170000
-SEQUENCE:0
-SUMMARY:Backhäfv
-UID:ZSGUP6BTM52UV42SEWBICHSS63V8DYQX5TSZ
-END:VEVENT
-END:VCALENDAR
diff --git a/tests/formats/event.xcs b/tests/formats/event.xcs deleted file mode 100644 index c3fd817f..00000000 --- a/tests/formats/event.xcs +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0"?> -<c:icalendar xmlns:c="urn:ietf:params:xml:ns:icalendar-2.0"> - <c:vcalendar> - <c:properties> - <c:prodid> - <c:text>-//PIMUTILS.ORG//NONSGML khal / icalendar //EN</c:text> - </c:prodid> - <c:version> - <c:text>2.0</c:text> - </c:version> - </c:properties> - <c:components> - <c:vtimezone> - <c:properties> - <c:tzid> - <c:text>Europe/Stockholm</c:text> - </c:tzid> - </c:properties> - <c:components> - <c:daylight> - <c:properties> - <c:dtstart><c:date-time>2018-03-25T03:00:00</c:date-time></c:dtstart> - <c:tzname><c:text>CEST</c:text></c:tzname> - <c:tzoffsetfrom><c:utc-offset>+0100</c:utc-offset></c:tzoffsetfrom> - <c:tzoffsetto><c:utc-offset>+0200</c:utc-offset></c:tzoffsetto> - </c:properties> - </c:daylight> - <c:standard> - <c:properties> - <c:dtstart><c:date-time>2018-10-28T02:00:00</c:date-time></c:dtstart> - <c:tzname><c:text>CET</c:text></c:tzname> - <c:tzoffsetfrom><c:utc-offset>+0200</c:utc-offset></c:tzoffsetfrom> - <c:tzoffsetto><c:utc-offset>+0100</c:utc-offset></c:tzoffsetto> - </c:properties> - </c:standard> - </c:components> - </c:vtimezone> - <c:vevent> - <c:properties> - <c:dtend><c:parameters><c:tzid><c:text>Europe/Stockholm</c:text></c:tzid></c:parameters><c:date-time>2018-09-07T18:00:00</c:date-time></c:dtend> - <c:dtstamp><c:date-time>2018-09-07T15:42:23Z</c:date-time></c:dtstamp> - <c:dtstart><c:parameters><c:tzid><c:text>Europe/Stockholm</c:text></c:tzid></c:parameters><c:date-time>2018-09-07T17:00:00</c:date-time></c:dtstart> - <c:sequence><c:integer>0</c:integer></c:sequence> - <c:summary><c:text>Backhäfv</c:text></c:summary> - <c:uid><c:text>ZSGUP6BTM52UV42SEWBICHSS63V8DYQX5TSZ</c:text></c:uid> - </c:properties> - </c:vevent> - </c:components> - </c:vcalendar> -</c:icalendar> diff --git a/tests/formats/ical.scm b/tests/formats/ical.scm deleted file mode 100644 index 5747e2ea..00000000 --- a/tests/formats/ical.scm +++ /dev/null @@ -1,24 +0,0 @@ -(define-module (ical) - :use-module (srfi srfi-88) - :use-module ((hnh util) :select (sort*)) - :use-module (hnh util path) - :use-module ((rnrs io ports) :select (get-string-all)) - :use-module ((vcomponent formats ical) :prefix #{ics:}#) - :export (sanitize-string - serialize - deserialize - component-str)) - -;; Technically not back into source, since order of children isn't -;; stable. That's also why we just check that all lines are present, -;; regardless of order. -(define (sanitize-string str) - (sort* (string-split str #\newline) - string<)) - -(define serialize ics:serialize) -(define deserialize ics:deserialize) - -(define component-str - (call-with-input-file (path-append (getenv "here") "event.ics") - get-string-all)) diff --git a/tests/formats/test.scm b/tests/formats/test.scm deleted file mode 100755 index 48c6bb76..00000000 --- a/tests/formats/test.scm +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env bash -# -*- mode: scheme; geiser-scheme-implementation: guile -*- - -here=$(dirname $(realpath $0)) -export here -root="$(dirname "$(dirname "$here")")" -eval $(env __PRINT_ENVIRONMENT=1 "${root}/calp") - -exec "$GUILE" -s "$0" "$@" -!# - -(use-modules (srfi srfi-64) - (srfi srfi-88) - (vcomponent) - (vcomponent create) - (datetime) - (datetime timespec) - ((hnh util) :select (for print-and-return)) - (hnh test testrunner)) - - -(verbose? #t) -(test-runner-factory (construct-test-runner display)) - -(define component - (vcomponent - 'VCALENDAR - version: "2.0" - prodid: "-//PIMUTILS.ORG//NONSGML khal / icalendar //EN" - (list - (vcomponent - 'VEVENT - summary: "Backhäfv" - dtstart: (with-parameters tzid: "Europe/Stockholm" - value: "DATE-TIME" - #2018-09-07T17:00:00) - dtend: (with-parameters tzid: "Europe/Stockholm" - value: "DATE-TIME" - #2018-09-07T18:00:00) - dtstamp: (with-parameters value: "DATE-TIME" - #2018-09-07T15:42:23Z) - uid: "ZSGUP6BTM52UV42SEWBICHSS63V8DYQX5TSZ" - sequence: 0) - (vcomponent - 'VTIMEZONE - tzid: "Europe/Stockholm" - (list (vcomponent - 'STANDARD - dtstart: (with-parameters value: "DATE-TIME" - #2018-10-28T02:00:00) - tzname: "CET" - tzoffsetfrom: (make-timespec #02:00 '+ #\z) - tzoffsetto: (make-timespec #01:00 '+ #\z)) - (vcomponent - 'DAYLIGHT - dtstart: (with-parameters value: "DATE-TIME" - #2018-03-25T03:00:00) - tzname: "CEST" - tzoffsetfrom: (make-timespec #01:00 '+ #\z) - tzoffsetto: (make-timespec #02:00 '+ #\z)))) - ))) - -(add-to-load-path (getenv "here")) - -(test-begin "Serialization Formats") - - - -(for test in '(ical xcal) - (test-group (format #f "Format: ~a" test) - (let ((interface (resolve-interface (list test)))) - (let ((component-str (module-ref interface 'component-str)) - (serialize (module-ref interface 'serialize)) - (deserialize (module-ref interface 'deserialize)) - (sanitize-string (module-ref interface 'sanitize-string))) - - (test-equal "Serialize" - (sanitize-string component-str) - (sanitize-string - (call-with-output-string - (lambda (p) (serialize component p))))) - - (test-group "Deserialize" - (let ((object (call-with-input-string component-str deserialize))) - (test-assert "Deserialize worked" (vcomponent? object)) - - (test-equal "Deserialized object serializes back into source" - (sanitize-string component-str) - (sanitize-string - (call-with-output-string - (lambda (p) (serialize object p))))))) - - - (test-assert "Serialized string can still be read back in" - (vcomponent? - (let* ((obj1 (call-with-input-string component-str deserialize)) - (str2 (call-with-output-string (lambda (p) (serialize obj1 p)))) - (obj2 (call-with-input-string str2 deserialize))) - obj2))))))) - - -(test-end) diff --git a/tests/formats/xcal.scm b/tests/formats/xcal.scm deleted file mode 100644 index 4c27931a..00000000 --- a/tests/formats/xcal.scm +++ /dev/null @@ -1,26 +0,0 @@ -(define-module (xcal) - :use-module (srfi srfi-88) - :use-module (hnh test xmllint) - :use-module (hnh util path) - :use-module ((rnrs io ports) :select (get-string-all)) - :use-module ((vcomponent formats xcal) :prefix #{xcs:}#) - :use-module ((calp namespaces) :select (xcal)) - :export (sanitize-string - serialize - deserialize - component-str)) - -(define (sanitize-string str) - (xmllint str)) - -(define serialize - (lambda (component port) - (xcs:serialize - component port namespaces: `((,xcal . c)) - ))) - -(define deserialize xcs:deserialize) - -(define component-str - (call-with-input-file (path-append (getenv "here") "event.xcs") - get-string-all)) |