From e535eff9040eac07ca43c9db28aa2fd1a61f3b48 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sun, 22 Mar 2020 07:50:59 +0100 Subject: Extend iCalendar import tests Tests ical-010.sh and ical-011.sh assume that Github issue #265 has been fixed (escape-encoding by export). Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- test/Makefile.am | 8 +++++- test/data/apts-export | 2 ++ test/data/ical-009.ical | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ test/data/todo-export | 1 + test/ical-009.sh | 33 ++++++++++++++++++++++++ test/ical-010.sh | 34 +++++++++++++++++++++++++ test/ical-011.sh | 20 +++++++++++++++ 7 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 test/data/apts-export create mode 100644 test/data/ical-009.ical create mode 100644 test/data/todo-export create mode 100755 test/ical-009.sh create mode 100755 test/ical-010.sh create mode 100755 test/ical-011.sh (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am index d896dc3..6b04d86 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -56,6 +56,9 @@ TESTS = \ ical-006.sh \ ical-007.sh \ ical-008.sh \ + ical-009.sh \ + ical-010.sh \ + ical-011.sh \ next-001.sh \ next-002.sh \ next-003.sh \ @@ -117,6 +120,7 @@ EXTRA_DIST = \ data/apts-event-004 \ data/apts-event-005 \ data/apts-event-006 \ + data/apts-export \ data/apts-filter-001 \ data/apts-recur \ data/apts-regress-001 \ @@ -129,4 +133,6 @@ EXTRA_DIST = \ data/ical-006.ical \ data/ical-007.ical \ data/ical-008.ical \ - data/todo + data/ical-009.ical \ + data/todo \ + data/todo-export diff --git a/test/data/apts-export b/test/data/apts-export new file mode 100644 index 0000000..65fbbc4 --- /dev/null +++ b/test/data/apts-export @@ -0,0 +1,2 @@ +02/26/2020 @ 07:09 -> 02/26/2020 @ 07:10|Exported, escaped characters in SUMMARY: ,(comma), ;(semicolon) , and \(escape). +02/26/2020 [1] Exported, escaped characters in SUMMARY: ,(comma), ;(semicolon) , and \(escape). diff --git a/test/data/ical-009.ical b/test/data/ical-009.ical new file mode 100644 index 0000000..73e9037 --- /dev/null +++ b/test/data/ical-009.ical @@ -0,0 +1,68 @@ +BEGIN:VCALENDAR +VERSION:2.0 +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +SUMMARY:A simple appointment +END:VEVENT +BEGIN:VTODO +PRIORITY:1 +SUMMARY:A simple todo +END:VTODO +BEGIN:VEVENT +DTSTART: +DURATION:PT1H30M0S +SUMMARY:missing start time +END:VEVENT +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +RRULE:FREQ=HOURLY;INTERVAL=2;UNTIL=20200401T000000 +SUMMARY:unsupported frequency +END:VEVENT +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +SUMMARY malformed summary line +END:VEVENT +BEGIN:VTODO +PRIORITY:10 +SUMMARY:invalid priority +END:VTODO +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +RRULE:FREQ=DAILY;INTERVAL=2;UNTIL=20200401T000000 +EXDATE 20200324T084100 +SUMMARY:malformed exceptions line +END:VEVENT +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +SUMMARY:Summary with more than\none line +END:VEVENT +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +SUMMARY:malformed description line +DESCRIPTION something is missing +END:VEVENT +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +SUMMARY:malformed description +DESCRIPTION:description with an unescaped semicolon (;) +END:VEVENT +BEGIN:VEVENT +DTSTART:20200318T084100 +DURATION:PT1H30M0S +SUMMARY:empty DESCRIPTION +DESCRIPTION: +END:VEVENT +BEGIN:VTODO +PRIORITY:1 +SUMMARY:an unescaped comma: , +END:VTODO +BEGIN:VTODO +SUMMARY:finally\, missing end of item +END:VCALENDAR diff --git a/test/data/todo-export b/test/data/todo-export new file mode 100644 index 0000000..b7cfc23 --- /dev/null +++ b/test/data/todo-export @@ -0,0 +1 @@ +[1] Exported, escaped characters in SUMMARY: ,(comma), ;(semicolon) , and \(escape). diff --git a/test/ical-009.sh b/test/ical-009.sh new file mode 100755 index 0000000..9558f15 --- /dev/null +++ b/test/ical-009.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Import with skipped items. + +. "${TEST_INIT:-./test-init.sh}" + +if [ "$1" = 'actual' ]; then + mkdir .calcurse || exit 1 + cp "$DATA_DIR/conf" .calcurse || exit 1 + out=$("$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-009.ical" 2>&1) + echo "$out" | sed -n '4,5p' + log=$(echo "$out" | awk '$1 == "See" {print $2}') + cat "$log" | sed '1,17d' + rm -rf .calcurse || exit 1 +elif [ "$1" = 'expected' ]; then + cat < "$PWD"/.calcurse/export.ical && +(cd .calcurse; mv apts apts-export; mv todo todo-export) && +"$CALCURSE" -D "$PWD/.calcurse" --quiet --import \ + "$PWD"/.calcurse/export.ical && +(cd .calcurse; cmp -s apts-export apts) && +(cd .calcurse; cmp -s todo-export todo) && +status=0 || status=1 + +rm -rf .calcurse +exit $status -- cgit v1.2.3-70-g09d2