From 701f8e4fbd15bd804b43b44566a19c0f07a20b16 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 12 Oct 2020 11:01:43 -0400 Subject: 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 --- test/recur-010.sh | 23 +++++++++++++++-------- 1 file 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 <