mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
AK: Allow Optional<T>
to be used in constant expressions
This commit is contained in:
parent
063be28e90
commit
a059ab4677
Notes:
github-actions[bot]
2025-04-23 03:21:35 +00:00
Author: https://github.com/yyny
Commit: a059ab4677
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4310
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/DanShaders
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/alimpfard ✅
4 changed files with 233 additions and 86 deletions
|
@ -130,6 +130,9 @@ bool assume(T const& expression, StringView expression_string, SourceLocation lo
|
|||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
consteval void expect_consteval(T) { }
|
||||
|
||||
}
|
||||
|
||||
#define EXPECT(...) \
|
||||
|
@ -179,6 +182,8 @@ bool assume(T const& expression, StringView expression_string, SourceLocation lo
|
|||
::Test::set_current_test_result(::Test::TestResult::Failed); \
|
||||
} while (false)
|
||||
|
||||
#define EXPECT_CONSTEVAL(...) ::Test::expect_consteval(__VA_ARGS__)
|
||||
|
||||
// To use, specify the lambda to execute in a sub process and verify it exits:
|
||||
// EXPECT_CRASH("This should fail", []{
|
||||
// return Test::Crash::Failure::DidNotCrash;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue