1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

Tests: Make TestSourceLocation basic_scenario specify StringView length

This commit is contained in:
sin-ack 2022-07-11 20:29:31 +00:00 committed by Andreas Kling
parent 3d656ba600
commit 3e1d0d9425

View file

@ -13,9 +13,14 @@
TEST_CASE(basic_scenario)
{
auto location = SourceLocation::current();
EXPECT_EQ(StringView(__FUNCTION__), location.function_name());
EXPECT_EQ(__LINE__ - 2u, location.line_number());
EXPECT_EQ(StringView(__FILE__), location.filename());
EXPECT_EQ(__LINE__ - 1u, location.line_number());
// Obviously not the prettiest way.
StringView function { __FUNCTION__, strlen(__FUNCTION__) };
StringView file { __FILE__, strlen(__FILE__) };
EXPECT_EQ(function, location.function_name());
EXPECT_EQ(file, location.filename());
}
static StringView test_default_arg(SourceLocation const& loc = SourceLocation::current())