From f2a7eea311116691a90120c3e0ba0f1ce7fac6c5 Mon Sep 17 00:00:00 2001
From: Lars Henriksen <LarsHenriksen@get2net.dk>
Date: Fri, 21 Aug 2020 11:12:50 +0200
Subject: Extend icalendar export

Export now covers advanced recurrence rules and properties imported to a note
file.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
---
 test/Makefile.am        |   1 +
 test/data/ical-014.ical | 106 ++++++++++++++++++++++++++++++++++++++++++++++++
 test/ical-014.sh        |  28 +++++++++++++
 3 files changed, 135 insertions(+)
 create mode 100644 test/data/ical-014.ical
 create mode 100755 test/ical-014.sh

(limited to 'test')

diff --git a/test/Makefile.am b/test/Makefile.am
index dfb97c3..daa6e77 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -61,6 +61,7 @@ TESTS = \
 	ical-011.sh \
 	ical-012.sh \
 	ical-013.sh \
+	ical-014.sh \
 	next-001.sh \
 	next-002.sh \
 	next-003.sh \
diff --git a/test/data/ical-014.ical b/test/data/ical-014.ical
new file mode 100644
index 0000000..19076bc
--- /dev/null
+++ b/test/data/ical-014.ical
@@ -0,0 +1,106 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+
+BEGIN:VEVENT
+DTSTART:20200404T204500
+DURATION:PT1H30M0S
+SUMMARY:event with one-line description
+DESCRIPTION:event with one-line description
+END:VEVENT
+
+BEGIN:VEVENT
+DTSTART:20200404T204500
+DURATION:PT1H30M0S
+SUMMARY:description and location
+DESCRIPTION:event with description\nand location
+LOCATION:Right here
+END:VEVENT
+
+BEGIN:VEVENT
+DTSTART:20200404T084100
+DURATION:PT1H30M0S
+SUMMARY:no description\, but comment
+COMMENT:Event without description: a comment\nstreching over\nthree lines
+END:VEVENT
+
+BEGIN:VEVENT
+DTSTART:20200404T084100
+DURATION:PT1H30M0S
+SUMMARY:Empty description
+DESCRIPTION:
+END:VEVENT
+
+BEGIN:VEVENT
+DTSTART:20200404T084100
+DURATION:PT1H30M0S
+SUMMARY:Empty description\, but comment
+DESCRIPTION:
+COMMENT:event with empty description
+END:VEVENT
+
+BEGIN:VEVENT
+DTSTART:20200404T204500
+DURATION:PT1H30M0S
+SUMMARY:description\, comment and location
+DESCRIPTION:event with\ndescription\ncomment\nand location
+LOCATION:Right here
+COMMENT:just a repetition of description:\nevent with\ndescription\ncomment\nand location
+END:VEVENT
+
+BEGIN:VTODO
+PRIORITY:2
+SUMMARY:todo with one-line description
+DESCRIPTION:todo with one-line description
+END:VTODO
+
+BEGIN:VTODO
+PRIORITY:3
+SUMMARY:description and location
+DESCRIPTION:todo with description\nand location
+LOCATION:Right here
+END:VTODO
+
+BEGIN:VTODO
+PRIORITY:4
+SUMMARY:no description\, but comment
+COMMENT:Todo without description. A comment\nstreching over\nthree lines
+END:VTODO
+
+BEGIN:VTODO
+PRIORITY:5
+SUMMARY:Empty description
+DESCRIPTION:
+END:VTODO
+
+BEGIN:VTODO
+PRIORITY:6
+SUMMARY:Empty description
+DESCRIPTION:
+END:VTODO
+
+BEGIN:VTODO
+SUMMARY:todo with description\, comment and location
+DESCRIPTION:todo with\ndescription\ncomment\nand location\,\nbut no priority
+LOCATION:Right here
+COMMENT:mostly a repetition of description:\ntodo with\ndescription\ncomment\nand location
+STATUS:COMPLETED
+END:VTODO
+
+BEGIN:VEVENT
+SUMMARY:Five days
+DESCRIPTION:A five-day event turned into a recurring one-day event
+COMMENT:Note file has Comment: and Import:
+DTSTART;VALUE=DATE:20200819
+DTEND;VALUE=DATE:20200824
+END:VEVENT
+
+BEGIN:VEVENT
+SUMMARY:CET
+DESCRIPTION:Date with local time and time zone reference
+LOCATION:Central Europe
+COMMENT:\nCET\n\n
+DTSTART;TZID=CET:20150223T110000
+DURATION:PT1H
+END:VEVENT
+
+END:VCALENDAR
diff --git a/test/ical-014.sh b/test/ical-014.sh
new file mode 100755
index 0000000..68f36a1
--- /dev/null
+++ b/test/ical-014.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Import followed by export and comparison
+
+. "${TEST_INIT:-./test-init.sh}"
+
+if [ "$1" = 'actual' ]; then
+  mkdir .calcurse || exit 1
+  cp "$DATA_DIR/conf" .calcurse || exit 1
+  "$CALCURSE" -q -D "$PWD/.calcurse" -i "$DATA_DIR/ical-014.ical"
+  "$CALCURSE" -D "$PWD/.calcurse" -x | 
+  sed -n '
+	/DESCRIPTION/p
+	/LOCATION/p
+	/COMMENT/p
+  ' |
+  sort
+  rm -rf .calcurse || exit 1
+elif [ "$1" = 'expected' ]; then
+  cat "$DATA_DIR/ical-014.ical" |
+  sed -n '
+	/DESCRIPTION/p
+	/LOCATION/p
+	/COMMENT/p
+  ' |
+  sort
+else
+  ./run-test "$0"
+fi
-- 
cgit v1.2.3-70-g09d2