diff options
author | Anna Wawrzyniak <anna.wawrzyniak@mongodb.com> | 2022-11-15 17:06:39 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-15 17:35:27 +0000 |
commit | d9c4ec0cec878db9d785ef4ff58d69c34247b9ed (patch) | |
tree | b45a958c322fe7b14de390108e37aa1eedb3c345 | |
parent | 493b63c41b1f5c143d24470e21ae6c0714f3f650 (diff) | |
download | mongo-d9c4ec0cec878db9d785ef4ff58d69c34247b9ed.tar.gz |
SERVER-71330 Golden test framework should produce empty expected output files
-rw-r--r-- | src/mongo/unittest/golden_test_base.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/unittest/golden_test_base.cpp b/src/mongo/unittest/golden_test_base.cpp index e8b6a9b298c..a8c8acd140d 100644 --- a/src/mongo/unittest/golden_test_base.cpp +++ b/src/mongo/unittest/golden_test_base.cpp @@ -178,9 +178,11 @@ void GoldenTestContextBase::failResultMismatch(const std::string& actualStr, fs::path expectedOutputFilePath = getExpectedOutputPath(); writeFile(actualOutputFilePath, actualStr); - if (expectedStr != boost::none) { - writeFile(expectedOutputFilePath, *expectedStr); - } + + // Write empty expected file even if the expected result was not set. + // This improves interaction with diff tools that fail or don't show contents if + // one of the file is missing. + writeFile(expectedOutputFilePath, expectedStr.get_value_or("")); _onError(message, actualStr, expectedStr); } |