diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-08-18 17:24:45 +0300 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-09-02 01:43:26 +0300 |
commit | 0cc05c5a31b6c6d3db76b5982f3f36919e137500 (patch) | |
tree | 7fa6a781b2ecd61ae3bc4372d7c12129ba13eba5 /tests/test_macros.h | |
parent | 6b7e50ab3410542d341bd1dd1ec70123fc218ecc (diff) |
Register GDScript test tools as test commands to run via command-line
Diffstat (limited to 'tests/test_macros.h')
-rw-r--r-- | tests/test_macros.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_macros.h b/tests/test_macros.h index 45ba8581dd..3486c68bb7 100644 --- a/tests/test_macros.h +++ b/tests/test_macros.h @@ -31,6 +31,9 @@ #ifndef TEST_MACROS_H #define TEST_MACROS_H +#include "core/map.h" +#include "core/variant.h" + // See documentation for doctest at: // https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md#reference #include "thirdparty/doctest/doctest.h" @@ -104,4 +107,17 @@ DOCTEST_STRINGIFY_VARIANT(PackedVector2Array); DOCTEST_STRINGIFY_VARIANT(PackedVector3Array); DOCTEST_STRINGIFY_VARIANT(PackedColorArray); +// Register test commands to be launched from the command-line. +// For instance: REGISTER_TEST_COMMAND("gdscript-parser" &test_parser_func). +// Example usage: `godot --test gdscript-parser`. + +typedef void (*TestFunc)(); +extern Map<String, TestFunc> *test_commands; +int register_test_command(String p_command, TestFunc p_function); + +#define REGISTER_TEST_COMMAND(m_command, m_function) \ + DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_VAR_)) = \ + register_test_command(m_command, m_function); \ + DOCTEST_GLOBAL_NO_WARNINGS_END() + #endif // TEST_MACROS_H |