mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
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.
This commit is contained in:
parent
89ee38fe5c
commit
35c0a6c54d
94 changed files with 522 additions and 579 deletions
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/TestSuite.h>
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/Result.h>
|
||||
|
@ -735,5 +735,3 @@ TEST_CASE(common_table_expression)
|
|||
validate("WITH table (column1, column2) AS (SELECT * FROM table) DELETE FROM table;", { false, { { "table", { "column1", "column2" } } } });
|
||||
validate("WITH RECURSIVE table AS (SELECT * FROM table) DELETE FROM table;", { true, { { "table", {} } } });
|
||||
}
|
||||
|
||||
TEST_MAIN(SqlStatementParser)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue