aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2020-10-12 11:01:43 -0400
committerLukas Fleischer <lfleischer@calcurse.org>2020-10-12 11:15:48 -0400
commit701f8e4fbd15bd804b43b44566a19c0f07a20b16 (patch)
tree8919b7c47467be4119c808a63a16514a535de5d7 /test
parentc1b3807cb01324a537949e110404cd687a2017cd (diff)
downloadcalcurse-701f8e4fbd15bd804b43b44566a19c0f07a20b16.tar.gz
calcurse-701f8e4fbd15bd804b43b44566a19c0f07a20b16.zip
test: fix recur-010.sh
Use mktemp(1) to create temporary directory. Copy missing todo file. Do not modify any files in tests. Simplify and make some commands more robust. Indent continuation lines. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'test')
-rwxr-xr-xtest/recur-010.sh23
1 files changed, 15 insertions, 8 deletions
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: