Don't create empty expectation files when updating test expectations

This commit is contained in:
priyansh786 2021-08-30 22:52:28 +05:30
parent 525b4c70e7
commit 803901fa7e

View File

@ -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."
}