diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-04-18 19:30:51 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-04-21 15:58:41 +0200 |
commit | 8eab5b0063137f8008562c5069a9f14ed34355b9 (patch) | |
tree | e823d6b91656aff69e299130cd8608a9c7740cfb /tests/formats/ical.scm | |
parent | Add xmllint shell-out for normalizing xml trees. (diff) | |
download | calp-8eab5b0063137f8008562c5069a9f14ed34355b9.tar.gz calp-8eab5b0063137f8008562c5069a9f14ed34355b9.tar.xz |
Add tests for serialization foramts.
These are outside the regular unit testing, since they are more of end
to end tests. Parts of this functionality is however still in the unit
tests.
Diffstat (limited to 'tests/formats/ical.scm')
-rw-r--r-- | tests/formats/ical.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/formats/ical.scm b/tests/formats/ical.scm new file mode 100644 index 00000000..5747e2ea --- /dev/null +++ b/tests/formats/ical.scm @@ -0,0 +1,24 @@ +(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)) |