summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-01-20 17:18:17 +0000
committerAndreas Kling <kling@serenityos.org>2022-01-24 22:36:09 +0100
commitc388a879d73633b6ebe8353fd2a0407b908fe26f (patch)
tree3a09d39c87751105ace98936c8c210c57eee2fe8 /Tests
parentf590cd1850027399ab7f0193ba97fa76b3a9cbab (diff)
downloadserenity-c388a879d73633b6ebe8353fd2a0407b908fe26f.zip
AK+Userland: Make AK::decode_base64 return ErrorOr
Diffstat (limited to 'Tests')
-rw-r--r--Tests/AK/TestBase64.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Tests/AK/TestBase64.cpp b/Tests/AK/TestBase64.cpp
index 38767e1741..fcda584a28 100644
--- a/Tests/AK/TestBase64.cpp
+++ b/Tests/AK/TestBase64.cpp
@@ -14,7 +14,7 @@ TEST_CASE(test_decode)
{
auto decode_equal = [&](const char* input, const char* expected) {
auto decoded_option = decode_base64(StringView(input));
- EXPECT(decoded_option.has_value());
+ EXPECT(!decoded_option.is_error());
auto decoded = decoded_option.release_value();
EXPECT(String::copy(decoded) == String(expected));
EXPECT(StringView(expected).length() <= calculate_base64_decoded_length(StringView(input).bytes()));
@@ -31,10 +31,10 @@ TEST_CASE(test_decode)
TEST_CASE(test_decode_invalid)
{
- EXPECT(!decode_base64(StringView("asdf\xffqwe")).has_value());
- EXPECT(!decode_base64(StringView("asdf\x80qwe")).has_value());
- EXPECT(!decode_base64(StringView("asdf:qwe")).has_value());
- EXPECT(!decode_base64(StringView("asdf=qwe")).has_value());
+ EXPECT(decode_base64(StringView("asdf\xffqwe")).is_error());
+ EXPECT(decode_base64(StringView("asdf\x80qwe")).is_error());
+ EXPECT(decode_base64(StringView("asdf:qwe")).is_error());
+ EXPECT(decode_base64(StringView("asdf=qwe")).is_error());
}
TEST_CASE(test_encode)