diff --git a/Tests/Utilities/TestPatch.cpp b/Tests/Utilities/TestPatch.cpp index e39c02f28f..ee5374b2e2 100644 --- a/Tests/Utilities/TestPatch.cpp +++ b/Tests/Utilities/TestPatch.cpp @@ -43,7 +43,7 @@ private: } }; -static void run_patch(Vector&& arguments, StringView standard_input, StringView expected_stdout) +static void run_patch(Vector&& arguments, StringView standard_input, Optional expected_stdout = {}) { // Ask patch to run the test in a temporary directory so we don't leave any files around. Vector args_with_chdir = { "patch", "-d", s_test_dir }; @@ -60,7 +60,9 @@ static void run_patch(Vector&& arguments, StringView standard_input if (status != Core::Command::ProcessResult::DoneWithZeroExitCode) { FAIL(MUST(String::formatted("patch didn't exit cleanly: status: {}, stdout:{}, stderr: {}", static_cast(status), StringView { stdout.bytes() }, StringView { stderr.bytes() }))); } - EXPECT_EQ(StringView { expected_stdout.bytes() }, StringView { stdout.bytes() }); + + if (expected_stdout.has_value()) + EXPECT_EQ(StringView { expected_stdout->bytes() }, StringView { stdout.bytes() }); } TEST_CASE(basic_change_patch)