aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/ical-009.ical12
-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.sh12
-rwxr-xr-xtest/ical-006.sh10
-rwxr-xr-xtest/ical-007.sh12
-rwxr-xr-xtest/ical-008.sh12
-rwxr-xr-xtest/ical-009.sh51
-rwxr-xr-xtest/ical-010.sh12
-rwxr-xr-xtest/ical-011.sh21
-rwxr-xr-xtest/ical-012.sh10
-rwxr-xr-xtest/ical-013.sh10
-rwxr-xr-xtest/ical-014.sh10
-rwxr-xr-xtest/io-005.sh1
-rwxr-xr-xtest/io-006.sh1
-rw-r--r--test/run-test.c2
-rw-r--r--test/test-init.sh5
19 files changed, 121 insertions, 108 deletions
diff --git a/test/data/ical-009.ical b/test/data/ical-009.ical
index 3495223..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
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 5d38301..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
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 59b7bf8..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
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 9015323..6c1a0d4 100755
--- a/test/ical-009.sh
+++ b/test/ical-009.sh
@@ -4,40 +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: 0121 lines read
-2 apps / 0 events / 1 todo / 19 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]: only one location allowed.
-VEVENT [73]: invalid duration.
-VEVENT [78]: invalid or malformed event start time.
-VEVENT [83]: invalid end time value type.
-VEVENT [88]: invalid until format.
-VEVENT [94]: invalid exception date value type.
-VEVENT [101]: invalid exception.
-VEVENT [108]: either end or duration.
-VEVENT [114]: end must be later than start.
-VTODO [119]: 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 f4b27df..38ae673 100755
--- a/test/ical-012.sh
+++ b/test/ical-012.sh
@@ -7,11 +7,11 @@
. "${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: 0089 lines read
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
index 68f36a1..18134bf 100755
--- a/test/ical-014.sh
+++ b/test/ical-014.sh
@@ -4,17 +4,17 @@
. "${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 |
+ 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 .calcurse || exit 1
+ rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then
cat "$DATA_DIR/ical-014.ical" |
sed -n '
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/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