summaryrefslogtreecommitdiff
path: root/AK/Tests/TestOptional.cpp
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-12-30 21:16:37 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-31 00:51:12 +0100
commita7c014125fcf82be8c3cb39398e439babe21c99f (patch)
treec7154f88095cfc827b80a4d7269020cdd20a186d /AK/Tests/TestOptional.cpp
parentc770b0bbeca06150d74f888f01649b2e37058448 (diff)
downloadserenity-a7c014125fcf82be8c3cb39398e439babe21c99f.zip
AK: Add operator* and operator-> overloads in Optional.
Diffstat (limited to 'AK/Tests/TestOptional.cpp')
-rw-r--r--AK/Tests/TestOptional.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/AK/Tests/TestOptional.cpp b/AK/Tests/TestOptional.cpp
index 76b3bf2676..15ac04c25f 100644
--- a/AK/Tests/TestOptional.cpp
+++ b/AK/Tests/TestOptional.cpp
@@ -66,4 +66,12 @@ TEST_CASE(optional_leak_1)
EXPECT_EQ(vec[0].str.value(), "foo");
}
+TEST_CASE(short_notation)
+{
+ Optional<StringView> value = "foo";
+
+ EXPECT_EQ(value->length(), 3u);
+ EXPECT_EQ(*value, "foo");
+}
+
TEST_MAIN(Optional)