summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-09-19 22:10:51 +0200
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-09-21 04:22:52 +0430
commit743470c8f299419199c578efc80e405a8ec0e4d0 (patch)
tree6f1d12b49db29df210a2b1b27e94286622ee88a8 /Tests
parentf261b68408a13ac6a216eb2ec070b1de1cc428c6 (diff)
downloadserenity-743470c8f299419199c578efc80e405a8ec0e4d0.zip
AK: Introduce ability to default-initialize a Variant
I noticed that Variant<Empty, …> is a somewhat common pattern while working on #10080, and this will simplify a few use-cases. :^)
Diffstat (limited to 'Tests')
-rw-r--r--Tests/AK/TestVariant.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Tests/AK/TestVariant.cpp b/Tests/AK/TestVariant.cpp
index 8175b695da..f05c629022 100644
--- a/Tests/AK/TestVariant.cpp
+++ b/Tests/AK/TestVariant.cpp
@@ -219,3 +219,10 @@ TEST_CASE(copy_assign)
EXPECT_EQ(the_value.get<String>(), "Hello, world!");
}
}
+
+TEST_CASE(default_empty)
+{
+ Variant<Empty, int> my_variant;
+ EXPECT(my_variant.has<Empty>());
+ EXPECT(!my_variant.has<int>());
+}