1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Tests: Prefer TRY_OR_FAIL() and MUST() over EXPECT(!.is_error())

Note that in some cases (in particular SQL::Result and PDFErrorOr),
there is no Formatter defined for the error type, hence TRY_OR_FAIL
cannot work as-is. Furthermore, this commit leaves untouched the places
where MUST could be replaced by TRY_OR_FAIL.

Inspired by:
https://github.com/SerenityOS/serenity/pull/18710#discussion_r1186892445
This commit is contained in:
Ben Wiederhake 2023-05-07 20:14:06 +02:00 committed by Andrew Kaster
parent 87a7299078
commit f890b70eae
23 changed files with 415 additions and 742 deletions

View file

@ -50,8 +50,6 @@ TEST_CASE(join_dead_thread)
// The thread should have exited by then.
usleep(40 * 1000);
auto join_result = thread->join<int*>();
EXPECT(!join_result.is_error());
EXPECT_EQ(join_result.value(), static_cast<int*>(0));
auto join_result = TRY_OR_FAIL(thread->join<int*>());
EXPECT_EQ(join_result, static_cast<int*>(0));
}