aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am1
-rw-r--r--test/data/ical-005.ical2
-rw-r--r--test/data/ical-009.ical18
-rw-r--r--test/data/ical-012.ical26
-rw-r--r--test/data/ical-014.ical106
-rwxr-xr-xtest/ical-001.sh12
-rwxr-xr-xtest/ical-002.sh10
-rwxr-xr-xtest/ical-003.sh14
-rwxr-xr-xtest/ical-004.sh12
-rwxr-xr-xtest/ical-005.sh15
-rwxr-xr-xtest/ical-006.sh10
-rwxr-xr-xtest/ical-007.sh13
-rwxr-xr-xtest/ical-008.sh12
-rwxr-xr-xtest/ical-009.sh52
-rwxr-xr-xtest/ical-010.sh12
-rwxr-xr-xtest/ical-011.sh21
-rwxr-xr-xtest/ical-012.sh29
-rwxr-xr-xtest/ical-013.sh10
-rwxr-xr-xtest/ical-014.sh28
-rwxr-xr-xtest/io-005.sh1
-rwxr-xr-xtest/io-006.sh1
-rwxr-xr-xtest/recur-008.sh2
-rwxr-xr-xtest/recur-009.sh6
-rwxr-xr-xtest/recur-010.sh23
-rw-r--r--test/run-test.c2
-rw-r--r--test/test-init.sh5
26 files changed, 290 insertions, 153 deletions
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-005.ical b/test/data/ical-005.ical
index 5f20f48..e417779 100644
--- a/test/data/ical-005.ical
+++ b/test/data/ical-005.ical
@@ -18,6 +18,6 @@ TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
SUMMARY:On day 2
-DTSTART;VALUE=DATE:20131003
+DTSTART;VALUE=DATE:20131004
END:VEVENT
END:VCALENDAR
diff --git a/test/data/ical-009.ical b/test/data/ical-009.ical
index b5a6575..14bf4eb 100644
--- a/test/data/ical-009.ical
+++ b/test/data/ical-009.ical
@@ -1,9 +1,9 @@
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
-DTSTART:20200318T084100
DURATION:PT1H30M0S
SUMMARY:A simple appointment
+DTSTART:20200318T084100
END:VEVENT
BEGIN:VTODO
PRIORITY:1
@@ -12,6 +12,10 @@ END:VTODO
BEGIN:VEVENT
DTSTART:
DURATION:PT1H30M0S
+SUMMARY:invalid start time
+END:VEVENT
+BEGIN:VEVENT
+DURATION:PT1H30M0S
SUMMARY:missing start time
END:VEVENT
BEGIN:VEVENT
@@ -39,6 +43,12 @@ END:VEVENT
BEGIN:VEVENT
DTSTART:20200318T084100
DURATION:PT1H30M0S
+EXDATE:20200324T084100
+SUMMARY:exdate\, missing rrule
+END:VEVENT
+BEGIN:VEVENT
+DTSTART:20200318T084100
+DURATION:PT1H30M0S
SUMMARY:Summary with more than\none line
END:VEVENT
BEGIN:VEVENT
@@ -66,12 +76,6 @@ END:VTODO
BEGIN:VEVENT
DTSTART:20200406T221300
DURATION:PT0H15M0S
-SUMMARY:Invalid STATUS
-STATUS:confirmed
-END:VEVENT
-BEGIN:VEVENT
-DTSTART:20200406T221300
-DURATION:PT0H15M0S
SUMMARY:LOCATION twice
LOCATION:first
LOCATION:second
diff --git a/test/data/ical-012.ical b/test/data/ical-012.ical
index 09385fb..05604af 100644
--- a/test/data/ical-012.ical
+++ b/test/data/ical-012.ical
@@ -19,9 +19,8 @@ END:VEVENT
BEGIN:VEVENT
DTSTART:20200404T084100
DURATION:PT1H30M0S
-SUMMARY:No description. Comment and status
+SUMMARY:no description\, but comment
COMMENT:Event without description: a comment\nstreching over\nthree lines
-STATUS:CONFIRMED
END:VEVENT
BEGIN:VEVENT
@@ -42,11 +41,10 @@ END:VEVENT
BEGIN:VEVENT
DTSTART:20200404T204500
DURATION:PT1H30M0S
-SUMMARY:description\, status\, comment and location
-DESCRIPTION:event with\ndescription\nstatus\ncomment\nand location
+SUMMARY:description\, comment and location
+DESCRIPTION:event with\ndescription\ncomment\nand location
LOCATION: Right here
-COMMENT:just a repetition of description:\nevent with\ndescription\nstatus\ncomment\nand location
-STATUS:CANCELLED
+COMMENT:just a repetition of description:\nevent with\ndescription\ncomment\nand location
END:VEVENT
BEGIN:VTODO
@@ -64,9 +62,8 @@ END:VTODO
BEGIN:VTODO
PRIORITY:4
-SUMMARY:Comment and status
-COMMENT:Todo with out description. A comment\nstreching over\nthree lines
-STATUS:NEEDS-ACTION
+SUMMARY:no description\, but comment
+COMMENT:Todo without description. A comment\nstreching over\nthree lines
END:VTODO
BEGIN:VTODO
@@ -77,17 +74,16 @@ END:VTODO
BEGIN:VTODO
PRIORITY:6
-SUMMARY:Empty description\,but status
+SUMMARY:Empty description
DESCRIPTION:
-STATUS:COMPLETED
END:VTODO
BEGIN:VTODO
-SUMMARY:todo with description\, status\, comment and location
-DESCRIPTION:todo with\ndescription\nstatus\ncomment\nand location\,\nbut no priority
+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\nstatus\ncomment\nand location
-STATUS:IN-PROCESS
+COMMENT:mostly a repetition of description:\ntodo with\ndescription\ncomment\nand location
+STATUS:COMPLETED
END:VTODO
END:VCALENDAR
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-001.sh b/test/ical-001.sh
index 4ff1bfe..c8005a7 100755
--- a/test/ical-001.sh
+++ b/test/ical-001.sh
@@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-001.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s01/01/1980 -r2
- "$CALCURSE" -D "$PWD/.calcurse" -t
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-001.ical"
+ "$CALCURSE" -D "$tmpdir" -s01/01/1980 -r2
+ "$CALCURSE" -D "$tmpdir" -t
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0012 lines read
diff --git a/test/ical-002.sh b/test/ical-002.sh
index 0b74b19..eeecab4 100755
--- a/test/ical-002.sh
+++ b/test/ical-002.sh
@@ -3,11 +3,11 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-002.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s01/01/2000 -r2
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-002.ical"
+ "$CALCURSE" -D "$tmpdir" -s01/01/2000 -r2
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0028 lines read
diff --git a/test/ical-003.sh b/test/ical-003.sh
index cff65c0..ace0165 100755
--- a/test/ical-003.sh
+++ b/test/ical-003.sh
@@ -4,13 +4,13 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-003.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s01/01/2000 -r365
- "$CALCURSE" -D "$PWD/.calcurse" -s05/01/2020 --to 01/01/2023
- cat "$PWD/.calcurse/notes"/*
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-003.ical"
+ "$CALCURSE" -D "$tmpdir" -s01/01/2000 -r365
+ "$CALCURSE" -D "$tmpdir" -s05/01/2020 --to 01/01/2023
+ cat "$tmpdir/notes"/*
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0070 lines read
diff --git a/test/ical-004.sh b/test/ical-004.sh
index 7be6d1c..1d19d73 100755
--- a/test/ical-004.sh
+++ b/test/ical-004.sh
@@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-004.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s01/01/1980 -r2
- "$CALCURSE" -D "$PWD/.calcurse" -t
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-004.ical"
+ "$CALCURSE" -D "$tmpdir" -s01/01/1980 -r2
+ "$CALCURSE" -D "$tmpdir" -t
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0012 lines read
diff --git a/test/ical-005.sh b/test/ical-005.sh
index a73b90f..47891ee 100755
--- a/test/ical-005.sh
+++ b/test/ical-005.sh
@@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-005.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s10/03/2013 -r3
- cat "$PWD/.calcurse/notes"/*
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-005.ical"
+ "$CALCURSE" -D "$tmpdir" -s10/03/2013 -r3
+ cat "$tmpdir/notes"/*
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0023 lines read
@@ -16,11 +16,12 @@ Import process report: 0023 lines read
10/03/13:
* All day
* On day 1
- * On day 2
* Two days
10/04/13:
+ * On day 2
* Two days
+--
Import: multi-day event changed to one-day event
EOD
else
diff --git a/test/ical-006.sh b/test/ical-006.sh
index 6899d42..b923712 100755
--- a/test/ical-006.sh
+++ b/test/ical-006.sh
@@ -3,11 +3,11 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-006.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s06/01/2012 -r2
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-006.ical"
+ "$CALCURSE" -D "$tmpdir" -s06/01/2012 -r2
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0063 lines read
diff --git a/test/ical-007.sh b/test/ical-007.sh
index da5002c..82405c9 100755
--- a/test/ical-007.sh
+++ b/test/ical-007.sh
@@ -3,13 +3,13 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- TZ="America/New_York" "$CALCURSE" -D "$PWD/.calcurse" \
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ TZ="America/New_York" "$CALCURSE" -D "$tmpdir" \
-i "$DATA_DIR/ical-007.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s02/23/2015
- cat "$PWD/.calcurse/notes/"*
- rm -rf .calcurse || exit 1
+ "$CALCURSE" -D "$tmpdir" -s02/23/2015
+ cat "$tmpdir/notes/"*
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0018 lines read
@@ -21,6 +21,7 @@ Import process report: 0018 lines read
UTC
- 11:00 -> 12:00
Local time
+--
Import: TZID=CET
EOD
else
diff --git a/test/ical-008.sh b/test/ical-008.sh
index b659eb0..344fa8a 100755
--- a/test/ical-008.sh
+++ b/test/ical-008.sh
@@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-008.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s01/01/1980 -r2
- "$CALCURSE" -D "$PWD/.calcurse" -t
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-008.ical"
+ "$CALCURSE" -D "$tmpdir" -s01/01/1980 -r2
+ "$CALCURSE" -D "$tmpdir" -t
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0012 lines read
diff --git a/test/ical-009.sh b/test/ical-009.sh
index f397044..6c1a0d4 100755
--- a/test/ical-009.sh
+++ b/test/ical-009.sh
@@ -4,41 +4,41 @@
. "${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)
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ out=$("$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-009.ical" 2>&1)
# Print the import report (stdout).
echo "$out" | awk '$1 == "Import"; $2 == "apps"'
# Find the log file and print the log messages (stderr).
logfile=$(echo "$out" | awk '$1 == "See" { print $2 }')
sed '1,18d' "$logfile"
# One empty note file.
- cat "$PWD/.calcurse/notes"/* | wc | awk '{ print $1 $2 $3 }'
- rm -rf .calcurse || exit 1
+ cat "$tmpdir/notes"/* | wc | awk '{ print $1 $2 $3 }'
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
-Import process report: 0127 lines read
-2 apps / 0 events / 1 todo / 20 skipped
+Import process report: 0131 lines read
+3 apps / 0 events / 1 todo / 20 skipped
VEVENT [12]: invalid or malformed event start time.
-VEVENT [17]: rrule frequency not supported.
-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.
-VTODO [62]: malformed summary.
-VEVENT [66]: invalid status value.
-VEVENT [72]: only one location allowed.
-VEVENT [79]: invalid duration.
-VEVENT [84]: invalid or malformed event start time.
-VEVENT [89]: invalid end time value type.
-VEVENT [94]: invalid until format.
-VEVENT [100]: invalid exception date value type.
-VEVENT [107]: invalid exception.
-VEVENT [114]: either end or duration.
-VEVENT [120]: end must be later than start.
-VTODO [125]: The ical file seems to be malformed. The end of item was not found.
+VEVENT [17]: item start date not defined.
+VEVENT [21]: rrule frequency not supported.
+VEVENT [27]: malformed summary line.
+VTODO [32]: item priority is invalid (must be between 0 and 9).
+VEVENT [36]: malformed exceptions line.
+VEVENT [43]: exception date, but no recurrence rule.
+VEVENT [54]: malformed description line.
+VEVENT [60]: malformed description.
+VTODO [72]: malformed summary.
+VEVENT [76]: only one location allowed.
+VEVENT [83]: invalid duration.
+VEVENT [88]: invalid or malformed event start time.
+VEVENT [93]: invalid end time value type.
+VEVENT [98]: invalid until format.
+VEVENT [104]: invalid exception date value type.
+VEVENT [111]: invalid exception.
+VEVENT [118]: either end or duration.
+VEVENT [124]: end must be later than start.
+VTODO [129]: The ical file seems to be malformed. The end of item was not found.
101
EOD
else
diff --git a/test/ical-010.sh b/test/ical-010.sh
index 7cb1002..e66538c 100755
--- a/test/ical-010.sh
+++ b/test/ical-010.sh
@@ -4,12 +4,12 @@
. "${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
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ cp "$DATA_DIR/apts-export" "$tmpdir"/apts || exit 1
+ cp "$DATA_DIR/todo-export" "$tmpdir"/todo || exit 1
+ "$CALCURSE" -D "$tmpdir" --export=ical | sed '/^PRODID/d'
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
BEGIN:VCALENDAR
diff --git a/test/ical-011.sh b/test/ical-011.sh
index 4b6c238..1b76e6d 100755
--- a/test/ical-011.sh
+++ b/test/ical-011.sh
@@ -3,18 +3,17 @@
. "${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
+tmpdir=$(mktemp -d)
+cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+cp "$DATA_DIR/apts-export" "$tmpdir"/apts || exit 1
+cp "$DATA_DIR/todo-export" "$tmpdir"/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) &&
+"$CALCURSE" -D "$tmpdir" --export=ical >"$tmpdir"/export.ical &&
+(cd "$tmpdir"; mv apts apts-export; mv todo todo-export) &&
+"$CALCURSE" -D "$tmpdir" --quiet --import "$tmpdir"/export.ical &&
+(cd "$tmpdir"; cmp -s apts-export apts) &&
+(cd "$tmpdir"; cmp -s todo-export todo) &&
status=0 || status=1
-rm -rf .calcurse
+rm -rf "$tmpdir" || exit 1
exit $status
diff --git a/test/ical-012.sh b/test/ical-012.sh
index 9175db9..38ae673 100755
--- a/test/ical-012.sh
+++ b/test/ical-012.sh
@@ -7,18 +7,17 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse &&
- cp "$DATA_DIR/conf" .calcurse || exit 1
- "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-012.ical"
- (cd "$PWD/.calcurse/notes/"; cat $(ls -S1))
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-012.ical"
+ (cd "$tmpdir/notes/"; cat $(ls -S1))
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
-Import process report: 0093 lines read
+Import process report: 0089 lines read
6 apps / 0 events / 6 todos / 0 skipped
todo with
description
-status
comment
and location,
but no priority
@@ -27,13 +26,10 @@ Location: Right here
Comment: mostly a repetition of description:
todo with
description
- status
comment
and location
-Status: IN-PROCESS
event with
description
-status
comment
and location
--
@@ -41,18 +37,16 @@ Location: Right here
Comment: just a repetition of description:
event with
description
- status
comment
and location
-Status: CANCELLED
-Comment: Todo with out description. A comment
+--
+Comment: Event without description: a comment
streching over
three lines
-Status: NEEDS-ACTION
-Comment: Event without description: a comment
+--
+Comment: Todo without description. A comment
streching over
three lines
-Status: CONFIRMED
event with description
and location
--
@@ -67,9 +61,6 @@ Comment: event with empty description
event with one-line description
todo with one-line description
---
-Status: COMPLETED
-
EOD
else
./run-test "$0"
diff --git a/test/ical-013.sh b/test/ical-013.sh
index f5d012b..6509996 100755
--- a/test/ical-013.sh
+++ b/test/ical-013.sh
@@ -4,11 +4,11 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- mkdir .calcurse || exit 1
- cp "$DATA_DIR/conf" .calcurse || exit 1
- TZ=America/New_York "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/rfc5545.ical"
- "$CALCURSE" -D "$PWD/.calcurse" -s09/01/1997 -r365
- rm -rf .calcurse || exit 1
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ TZ=America/New_York "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/rfc5545.ical"
+ "$CALCURSE" -D "$tmpdir" -s09/01/1997 -r365
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat <<EOD
Import process report: 0238 lines read
diff --git a/test/ical-014.sh b/test/ical-014.sh
new file mode 100755
index 0000000..18134bf
--- /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
+ tmpdir=$(mktemp -d)
+ cp "$DATA_DIR/conf" "$tmpdir" || exit 1
+ "$CALCURSE" -q -D "$tmpdir" -i "$DATA_DIR/ical-014.ical"
+ "$CALCURSE" -D "$tmpdir" -x |
+ sed -n '
+ /DESCRIPTION/p
+ /LOCATION/p
+ /COMMENT/p
+ ' |
+ sort
+ rm -rf "$tmpdir" || 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
diff --git a/test/io-005.sh b/test/io-005.sh
index c5ebcc7..6b03908 100755
--- a/test/io-005.sh
+++ b/test/io-005.sh
@@ -3,7 +3,6 @@
. "${TEST_INIT:-./test-init.sh}"
home=$(mktemp -d)
-CALCURSE=$(readlink -f "$CALCURSE")
(unset -v XDG_DATA_HOME XDG_CONFIG_HOME; HOME="$home" "$CALCURSE" -a)
[ -f "$home/.local/share/calcurse/apts" ] && [ -f "$home/.config/calcurse/conf" ] && failed=0 || failed=1
diff --git a/test/io-006.sh b/test/io-006.sh
index 4184d9f..babcfcd 100755
--- a/test/io-006.sh
+++ b/test/io-006.sh
@@ -3,7 +3,6 @@
. "${TEST_INIT:-./test-init.sh}"
dir=$(mktemp -d)
-CALCURSE=$(readlink -f "$CALCURSE")
cd "$dir"
(unset -v HOME XDG_DATA_HOME XDG_CONFIG_HOME; "$CALCURSE" -a)
[ -f "$dir/.calcurse/apts" ] && [ -f "$dir/.calcurse/conf" ] && failed=0 || failed=1
diff --git a/test/recur-008.sh b/test/recur-008.sh
index c66bf12..75e4f5a 100755
--- a/test/recur-008.sh
+++ b/test/recur-008.sh
@@ -4,7 +4,7 @@
if [ "$1" = 'actual' ]; then
TZ='Europe/Copenhagen' "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-dst" \
- -Q --from 03/24/2019 --to 03/31/2020 --filter-type recur-apt
+ -Q --from 03/24/2019 --to 03/31/2020 --filter-type recur-apt
elif [ "$1" = 'expected' ]; then
cat <<EOD
03/24/19:
diff --git a/test/recur-009.sh b/test/recur-009.sh
index 2558b4c..8cfe896 100755
--- a/test/recur-009.sh
+++ b/test/recur-009.sh
@@ -5,13 +5,13 @@
if [ "$1" = 'actual' ]; then
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/rfc5545" \
- -Q --from 1/1/1996 --to 12/31/2007 --filter-type recur
+ -Q --from 1/1/1996 --to 12/31/2007 --filter-type recur
echo ""
echo "Floating point exception?"
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/rfc5545" \
- -Q --day 8/1/2020 --filter-type recur &&
+ -Q --day 8/1/2020 --filter-type recur &&
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/rfc5545" \
- -Q --day 11/1/2020 --filter-type recur &&
+ -Q --day 11/1/2020 --filter-type recur &&
echo "No Floating point exception on November 1, 2020"
elif [ "$1" = 'expected' ]; then
cat <<EOD
diff --git a/test/recur-010.sh b/test/recur-010.sh
index 5567a40..84cc581 100755
--- a/test/recur-010.sh
+++ b/test/recur-010.sh
@@ -5,14 +5,21 @@
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
- TMP=tmp
- mkdir "$TMP"
- cp "$DATA_DIR"/conf "$TMP"
- sed -n '/page 131/p' "$DATA_DIR"/rfc5545 > "$TMP"/apts
- "$CALCURSE" -D "$TMP" -Q --filter-type cal --startday=08/01/1997 --range=31
- sed 's/=monday/=sunday/' "$DATA_DIR"/conf > "$TMP"/conf
- "$CALCURSE" -D "$TMP" -Q --filter-type cal --startday=08/01/1997 --range=31
- rm -rf "$TMP"
+ tmpdir=$(mktemp -d)
+ grep 'page 131' "$DATA_DIR"/rfc5545 >"$tmpdir"/apts
+ cp "$DATA_DIR"/conf "$DATA_DIR"/todo "$tmpdir"
+ "$CALCURSE" --read-only -D "$tmpdir" -Q --filter-type cal \
+ --startday=08/01/1997 --range=31
+ rm -rf "$tmpdir"
+
+ tmpdir=$(mktemp -d)
+ grep 'page 131' "$DATA_DIR"/rfc5545 >"$tmpdir"/apts
+ cp "$DATA_DIR"/todo "$tmpdir"
+ sed 's/general.firstdayofweek=monday/general.firstdayofweek=sunday/' \
+ "$DATA_DIR"/conf >"$tmpdir"/conf
+ "$CALCURSE" --read-only -D "$tmpdir" -Q --filter-type cal \
+ --startday=08/01/1997 --range=31
+ rm -rf "$tmpdir"
elif [ "$1" = 'expected' ]; then
cat <<EOD
08/05/97:
diff --git a/test/run-test.c b/test/run-test.c
index d1db112..41d55ad 100644
--- a/test/run-test.c
+++ b/test/run-test.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/test-init.sh b/test/test-init.sh
index c95c884..92ad779 100644
--- a/test/test-init.sh
+++ b/test/test-init.sh
@@ -2,3 +2,8 @@
CALCURSE=${CALCURSE:-../src/calcurse}
DATA_DIR=${DATA_DIR:-data/}
+
+case "$CALCURSE" in
+ /*) ;;
+ *) CALCURSE="${PWD}/${CALCURSE}" ;;
+esac