mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
LibDiff/Tests: Make verifying against stdout optional
It's not always important to verify what the contents of stdout are when adding a patch test - especially if it's not exactly what we want it to be, so make this optional when running patch for a test.
This commit is contained in:
parent
9ec3480207
commit
947075ea7b
1 changed files with 4 additions and 2 deletions
|
@ -43,7 +43,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void run_patch(Vector<char const*>&& arguments, StringView standard_input, StringView expected_stdout)
|
static void run_patch(Vector<char const*>&& arguments, StringView standard_input, Optional<StringView> expected_stdout = {})
|
||||||
{
|
{
|
||||||
// Ask patch to run the test in a temporary directory so we don't leave any files around.
|
// Ask patch to run the test in a temporary directory so we don't leave any files around.
|
||||||
Vector<char const*> args_with_chdir = { "patch", "-d", s_test_dir };
|
Vector<char const*> args_with_chdir = { "patch", "-d", s_test_dir };
|
||||||
|
@ -60,7 +60,9 @@ static void run_patch(Vector<char const*>&& arguments, StringView standard_input
|
||||||
if (status != Core::Command::ProcessResult::DoneWithZeroExitCode) {
|
if (status != Core::Command::ProcessResult::DoneWithZeroExitCode) {
|
||||||
FAIL(MUST(String::formatted("patch didn't exit cleanly: status: {}, stdout:{}, stderr: {}", static_cast<int>(status), StringView { stdout.bytes() }, StringView { stderr.bytes() })));
|
FAIL(MUST(String::formatted("patch didn't exit cleanly: status: {}, stdout:{}, stderr: {}", static_cast<int>(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)
|
TEST_CASE(basic_change_patch)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue