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
Notes: sideshowbarker 2024-07-17 09:27:46 +09:00

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())