summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-07-29 14:23:53 +0200
committerGitHub <noreply@github.com>2020-07-29 14:23:53 +0200
commit7b17cd2a73d841ac8a3398fbeb8805a3bd707470 (patch)
tree74cd8c637ecadc8aec670911d2a543974f4dd43f /tests
parent157958c77cd91832a8cd2f3e29cc42b71f5484c0 (diff)
parent63720648e82911d4c5c27bcb091bee8a62adb923 (diff)
Merge pull request #40832 from Xrayez/tests-cleanup
Cleanup obsolete tests from displaying in help
Diffstat (limited to 'tests')
-rw-r--r--tests/test_main.cpp58
-rw-r--r--tests/test_main.h5
2 files changed, 8 insertions, 55 deletions
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 84d2fe1f6c..7c656517b6 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -32,8 +32,6 @@
#include "core/list.h"
-#ifdef DEBUG_ENABLED
-
#include "test_astar.h"
#include "test_basis.h"
#include "test_class_db.h"
@@ -54,37 +52,12 @@
#include "thirdparty/doctest/doctest.h"
-const char **tests_get_names() {
- static const char *test_names[] = {
- "*",
- "all",
- "math",
- "basis",
- "physics_2d",
- "physics_3d",
- "render",
- "oa_hash_map",
- "class_db",
- "gui",
- "shaderlang",
- "gd_tokenizer",
- "gd_parser",
- "gd_compiler",
- "gd_bytecode",
- "ordered_hash_map",
- "astar",
- nullptr
- };
-
- return test_names;
-}
-
int test_main(int argc, char *argv[]) {
- // doctest runner for when legacy unit tests are no found
+ // Doctest runner.
doctest::Context test_context;
List<String> valid_arguments;
- // clean arguments of --test from the args
+ // Clean arguments of "--test" from the args.
int argument_count = 0;
for (int x = 0; x < argc; x++) {
if (strncmp(argv[x], "--test", 6) != 0) {
@@ -92,15 +65,14 @@ int test_main(int argc, char *argv[]) {
argument_count++;
}
}
-
- // convert godot command line arguments back to standard arguments.
+ // Convert Godot command line arguments back to standard arguments.
char **args = new char *[valid_arguments.size()];
for (int x = 0; x < valid_arguments.size(); x++) {
- // operation to convert godot string to non wchar string
+ // Operation to convert Godot string to non wchar string.
const char *str = valid_arguments[x].utf8().ptr();
- // allocate the string copy
+ // Allocate the string copy.
args[x] = new char[strlen(str) + 1];
- // copy this into memory
+ // Copy this into memory.
std::memcpy(args[x], str, strlen(str) + 1);
}
@@ -109,22 +81,8 @@ int test_main(int argc, char *argv[]) {
test_context.setOption("order-by", "name");
test_context.setOption("abort-after", 5);
test_context.setOption("no-breaks", true);
- delete[] args;
- return test_context.run();
-}
-#else
-
-const char **tests_get_names() {
- static const char *test_names[] = {
- nullptr
- };
-
- return test_names;
-}
+ delete[] args;
-int test_main(int argc, char *argv[]) {
- return 0;
+ return test_context.run();
}
-
-#endif
diff --git a/tests/test_main.h b/tests/test_main.h
index 8273b74eac..983bfde402 100644
--- a/tests/test_main.h
+++ b/tests/test_main.h
@@ -31,11 +31,6 @@
#ifndef TEST_MAIN_H
#define TEST_MAIN_H
-#include "core/list.h"
-#include "core/os/main_loop.h"
-#include "core/ustring.h"
-
-const char **tests_get_names();
int test_main(int argc, char *argv[]);
#endif // TEST_MAIN_H