summaryrefslogtreecommitdiff
path: root/AK/Tests/TestSourceGenerator.cpp
diff options
context:
space:
mode:
authorAndrew Kaster <andrewdkaster@gmail.com>2021-04-24 23:53:23 -0600
committerAndreas Kling <kling@serenityos.org>2021-04-25 09:36:49 +0200
commit35c0a6c54d4e67f0d600044ed8eae0ae5e5adfba (patch)
treebf10d283d58b3e37c0db7aef4398dff6b1e07cd3 /AK/Tests/TestSourceGenerator.cpp
parent89ee38fe5cf6f62821dabc98f4dfbc109d0874fd (diff)
downloadserenity-35c0a6c54d4e67f0d600044ed8eae0ae5e5adfba.zip
AK+Userland: Move AK/TestSuite.h into LibTest and rework Tests' CMake
As many macros as possible are moved to Macros.h, while the macros to create a test case are moved to TestCase.h. TestCase is now the only user-facing header for creating a test case. TestSuite and its helpers have moved into a .cpp file. Instead of requiring a TEST_MAIN macro to be instantiated into the test file, a TestMain.cpp file is provided instead that will be linked against each test. This has the side effect that, if we wanted to have test cases split across multiple files, it's as simple as adding them all to the same executable. The test main should be portable to kernel mode as well, so if there's a set of tests that should be run in self-test mode in kernel space, we can accomodate that. A new serenity_test CMake function streamlines adding a new test with arguments for the test source file, subdirectory under /usr/Tests to install the test application and an optional list of libraries to link against the test application. To accomodate future test where the provided TestMain.cpp is not suitable (e.g. test-js), a CUSTOM_MAIN parameter can be passed to the function to not link against the boilerplate main function.
Diffstat (limited to 'AK/Tests/TestSourceGenerator.cpp')
-rw-r--r--AK/Tests/TestSourceGenerator.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/AK/Tests/TestSourceGenerator.cpp b/AK/Tests/TestSourceGenerator.cpp
index c6cd3fd6ea..9b8a3b7b6c 100644
--- a/AK/Tests/TestSourceGenerator.cpp
+++ b/AK/Tests/TestSourceGenerator.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <AK/TestSuite.h>
+#include <LibTest/TestCase.h>
#include <AK/SourceGenerator.h>
@@ -69,5 +69,3 @@ TEST_CASE(scoped)
EXPECT_EQ(global_generator.as_string_view(), "\nfoo-0 bar-0\nfoo-0 bar-0\nfoo-0 bar-0\nfoo-2 bar-0\nfoo-2 bar-3\nfoo-0 bar-0\nfoo-2 bar-0\n");
}
-
-TEST_MAIN(SourceGenerator)