From 3e1d0d942515c9da580dd75765ed0ce73ff0d772 Mon Sep 17 00:00:00 2001 From: sin-ack Date: Mon, 11 Jul 2022 20:29:31 +0000 Subject: [PATCH] Tests: Make TestSourceLocation basic_scenario specify StringView length --- Tests/AK/TestSourceLocation.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Tests/AK/TestSourceLocation.cpp b/Tests/AK/TestSourceLocation.cpp index 1f8e6b2359..fcaf905cd4 100644 --- a/Tests/AK/TestSourceLocation.cpp +++ b/Tests/AK/TestSourceLocation.cpp @@ -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())