aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-06-28 23:31:07 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-06-29 01:08:54 +0200
commit797cc1696c6ee1c8e42daa9fddf23f9baa7b2a71 (patch)
tree75396b280812d85f671a1666cbae33cb511fca8f
parentAdd xcal parser. (diff)
downloadcalp-797cc1696c6ee1c8e42daa9fddf23f9baa7b2a71.tar.gz
calp-797cc1696c6ee1c8e42daa9fddf23f9baa7b2a71.tar.xz
Add xcal tests.
-rw-r--r--tests/xcal.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/xcal.scm b/tests/xcal.scm
new file mode 100644
index 00000000..938a39b0
--- /dev/null
+++ b/tests/xcal.scm
@@ -0,0 +1,45 @@
+(((vcomponent parse xcal) sxcal->vcomponent)
+ ((vcomponent parse component) parse-calendar)
+ ((output xcal) vcomponent->sxcal)
+ ((util) ->)
+ ((vcomponent base)
+ properties attr* children)
+ )
+
+;;; Some different types, same parameters
+
+(define ev
+ (call-with-input-string "BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//calparse-test
+BEGIN:VEVENT
+SUMMARY:Test event
+DTSTART;TZID=Europe/Stockholm:20200625T133000
+DTEND:20200625T143000Z
+DTSTAMP:20200609T131418Z
+UID:1
+SEQUENCE:0
+CREATED:20200609T081725Z
+DESCRIPTION:Short description
+LAST-MODIFIED:20200609T081725Z
+STATUS;X-TEST-PARAM=10:CONFIRMED
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR"
+ parse-calendar))
+
+(define twice-converted
+ (-> ev
+ vcomponent->sxcal
+ sxcal->vcomponent))
+
+;;; NOTE both these tests may fail since neither attributes nor properties are ordered sorted.
+
+(test-equal "c->x & c->x->c->x"
+ (vcomponent->sxcal ev)
+ (vcomponent->sxcal twice-converted))
+
+(test-equal "xcal properties"
+ '((X-TEST-PARAM "10"))
+ (properties (attr* (car (children twice-converted))
+ 'STATUS)))