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 <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
ffbf714c9e
commit
e535eff904
@ -56,6 +56,9 @@ TESTS = \
|
|||||||
ical-006.sh \
|
ical-006.sh \
|
||||||
ical-007.sh \
|
ical-007.sh \
|
||||||
ical-008.sh \
|
ical-008.sh \
|
||||||
|
ical-009.sh \
|
||||||
|
ical-010.sh \
|
||||||
|
ical-011.sh \
|
||||||
next-001.sh \
|
next-001.sh \
|
||||||
next-002.sh \
|
next-002.sh \
|
||||||
next-003.sh \
|
next-003.sh \
|
||||||
@ -117,6 +120,7 @@ EXTRA_DIST = \
|
|||||||
data/apts-event-004 \
|
data/apts-event-004 \
|
||||||
data/apts-event-005 \
|
data/apts-event-005 \
|
||||||
data/apts-event-006 \
|
data/apts-event-006 \
|
||||||
|
data/apts-export \
|
||||||
data/apts-filter-001 \
|
data/apts-filter-001 \
|
||||||
data/apts-recur \
|
data/apts-recur \
|
||||||
data/apts-regress-001 \
|
data/apts-regress-001 \
|
||||||
@ -129,4 +133,6 @@ EXTRA_DIST = \
|
|||||||
data/ical-006.ical \
|
data/ical-006.ical \
|
||||||
data/ical-007.ical \
|
data/ical-007.ical \
|
||||||
data/ical-008.ical \
|
data/ical-008.ical \
|
||||||
data/todo
|
data/ical-009.ical \
|
||||||
|
data/todo \
|
||||||
|
data/todo-export
|
||||||
|
2
test/data/apts-export
Normal file
2
test/data/apts-export
Normal file
@ -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).
|
68
test/data/ical-009.ical
Normal file
68
test/data/ical-009.ical
Normal file
@ -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
|
1
test/data/todo-export
Normal file
1
test/data/todo-export
Normal file
@ -0,0 +1 @@
|
|||||||
|
[1] Exported, escaped characters in SUMMARY: ,(comma), ;(semicolon) , and \(escape).
|
33
test/ical-009.sh
Executable file
33
test/ical-009.sh
Executable file
@ -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 <<EOD
|
||||||
|
Import process report: 0068 lines read
|
||||||
|
1 app / 0 events / 1 todo / 11 skipped
|
||||||
|
|
||||||
|
VEVENT [12]: could not retrieve event start time.
|
||||||
|
VEVENT [17]: recurrence frequency not recognized.
|
||||||
|
VEVENT [23]: malformed summary line
|
||||||
|
VTODO [28]: item priority is invalid (must be between 0 and 9).
|
||||||
|
VEVENT [32]: malformed exceptions line.
|
||||||
|
VEVENT [39]: line break in summary.
|
||||||
|
VEVENT [44]: malformed description line.
|
||||||
|
VEVENT [50]: malformed description.
|
||||||
|
VEVENT [56]: empty description.
|
||||||
|
VTODO [62]: malformed summary.
|
||||||
|
VTODO [66]: The ical file seems to be malformed. The end of item was not found.
|
||||||
|
EOD
|
||||||
|
else
|
||||||
|
./run-test "$0"
|
||||||
|
fi
|
34
test/ical-010.sh
Executable file
34
test/ical-010.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ical export: encoded summary TEXT (escaped characters).
|
||||||
|
|
||||||
|
. "${TEST_INIT:-./test-init.sh}"
|
||||||
|
|
||||||
|
if [ "$1" = 'actual' ]; then
|
||||||
|
mkdir .calcurse || exit 1
|
||||||
|
cp "$DATA_DIR/conf" .calcurse || exit 1
|
||||||
|
cp "$DATA_DIR/apts-export" .calcurse/apts || exit 1
|
||||||
|
cp "$DATA_DIR/todo-export" .calcurse/todo || exit 1
|
||||||
|
"$CALCURSE" -D "$PWD/.calcurse" --export=ical | sed '/^PRODID/d'
|
||||||
|
rm -rf .calcurse || exit 1
|
||||||
|
elif [ "$1" = 'expected' ]; then
|
||||||
|
cat <<EOD
|
||||||
|
BEGIN:VCALENDAR
|
||||||
|
VERSION:2.0
|
||||||
|
BEGIN:VEVENT
|
||||||
|
DTSTART;VALUE=DATE:20200226
|
||||||
|
SUMMARY:Exported\, escaped characters in SUMMARY: \,(comma)\, \;(semicolon) \, and \\\\(escape).
|
||||||
|
END:VEVENT
|
||||||
|
BEGIN:VEVENT
|
||||||
|
DTSTART:20200226T070900
|
||||||
|
DURATION:P0DT0H1M0S
|
||||||
|
SUMMARY:Exported\, escaped characters in SUMMARY: \,(comma)\, \;(semicolon) \, and \\\\(escape).
|
||||||
|
END:VEVENT
|
||||||
|
BEGIN:VTODO
|
||||||
|
PRIORITY:1
|
||||||
|
SUMMARY:Exported\, escaped characters in SUMMARY: \,(comma)\, \;(semicolon) \, and \\\\(escape).
|
||||||
|
END:VTODO
|
||||||
|
END:VCALENDAR
|
||||||
|
EOD
|
||||||
|
else
|
||||||
|
./run-test "$0"
|
||||||
|
fi
|
20
test/ical-011.sh
Executable file
20
test/ical-011.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# encoded summary TEXT (escaped charaters): export, then import and compare.
|
||||||
|
|
||||||
|
. "${TEST_INIT:-./test-init.sh}"
|
||||||
|
|
||||||
|
mkdir .calcurse || exit 1
|
||||||
|
cp "$DATA_DIR/conf" .calcurse || exit 1
|
||||||
|
cp "$DATA_DIR/apts-export" .calcurse/apts || exit 1
|
||||||
|
cp "$DATA_DIR/todo-export" .calcurse/todo || exit 1
|
||||||
|
|
||||||
|
"$CALCURSE" -D "$PWD/.calcurse" --export=ical > "$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
|
Loading…
x
Reference in New Issue
Block a user