From 803901fa7e7b14394747a846b486e7ef343252b8 Mon Sep 17 00:00:00 2001 From: priyansh786 Date: Mon, 30 Aug 2021 22:52:28 +0530 Subject: [PATCH] Don't create empty expectation files when updating test expectations --- test/cmdlineTests.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index b5742e3bb..5d87357f0 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -71,6 +71,15 @@ function update_expectation { local newExpectation="${1}" local expectationFile="${2}" + if [[ $newExpectation == "" || $newExpectation -eq 0 && $expectationFile == */exit ]] + then + if [[ -f $expectationFile ]] + then + rm "$expectationFile" + fi + return + fi + echo "$newExpectation" > "$expectationFile" printLog "File $expectationFile updated to match the expectation." }