mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +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
Notes:
sideshowbarker
2024-07-17 02:39:10 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/947075ea7b Pull-request: https://github.com/SerenityOS/serenity/pull/23151 Reviewed-by: https://github.com/AtkinsSJ ✅
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.
|
||||
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) {
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue