1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

AK: Add ability to check Optional equality with an OptionalNone

While we don't want to be writing this type of code in 'normal'
code this is useful to do in tests as:

EXPECT_EQ(my_optional, OptionalNone {});

Has a much better error on assertion failure when compared with:

EXPECT(!my_optional.has_value());
This commit is contained in:
Shannon Booth 2025-03-13 18:29:59 +13:00 committed by Tim Flynn
parent e70272ddef
commit f05c0509c3
Notes: github-actions[bot] 2025-03-15 11:40:17 +00:00

View file

@ -570,6 +570,12 @@ ALWAYS_INLINE bool operator==(Optional<T1> const& first, T2 const& second)
return first.has_value() && first.value() == second;
}
template<typename T>
ALWAYS_INLINE bool operator==(Optional<T> const& first, OptionalNone)
{
return !first.has_value();
}
}
#if USING_AK_GLOBALLY