mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +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:
parent
87a7299078
commit
f890b70eae
23 changed files with 415 additions and 742 deletions
|
@ -13,9 +13,7 @@
|
|||
TEST_CASE(test_decode)
|
||||
{
|
||||
auto decode_equal = [&](StringView input, StringView expected) {
|
||||
auto decoded_option = decode_base64(input);
|
||||
EXPECT(!decoded_option.is_error());
|
||||
auto decoded = decoded_option.release_value();
|
||||
auto decoded = TRY_OR_FAIL(decode_base64(input));
|
||||
EXPECT(DeprecatedString::copy(decoded) == expected);
|
||||
EXPECT(expected.length() <= calculate_base64_decoded_length(input.bytes()));
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue