mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:17:34 +00:00
Tests: Move AK tests to Tests/AK
This commit is contained in:
parent
fd0dbd1ebf
commit
67322b0702
64 changed files with 1 additions and 2 deletions
32
Tests/AK/TestSourceLocation.cpp
Normal file
32
Tests/AK/TestSourceLocation.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andrew Kaster <andrewdkaster@gmail.com>
|
||||
* Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
#include <AK/SourceLocation.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
TEST_CASE(basic_scenario)
|
||||
{
|
||||
auto location = SourceLocation::current();
|
||||
EXPECT_EQ(StringView(__FILE__), location.filename());
|
||||
EXPECT_EQ(StringView(__FUNCTION__), location.function_name());
|
||||
EXPECT_EQ(__LINE__ - 3u, location.line_number());
|
||||
}
|
||||
|
||||
static StringView test_default_arg(const SourceLocation& loc = SourceLocation::current())
|
||||
{
|
||||
return loc.function_name();
|
||||
}
|
||||
|
||||
TEST_CASE(default_arg_scenario)
|
||||
{
|
||||
auto actual_calling_function = test_default_arg();
|
||||
auto expected_calling_function = StringView(__FUNCTION__);
|
||||
|
||||
EXPECT_EQ(expected_calling_function, actual_calling_function);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue