summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/test_gdscript.cpp
diff options
context:
space:
mode:
authorAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-08-18 17:24:45 +0300
committerAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-09-02 01:43:26 +0300
commit0cc05c5a31b6c6d3db76b5982f3f36919e137500 (patch)
tree7fa6a781b2ecd61ae3bc4372d7c12129ba13eba5 /modules/gdscript/tests/test_gdscript.cpp
parent6b7e50ab3410542d341bd1dd1ec70123fc218ecc (diff)
Register GDScript test tools as test commands to run via command-line
Diffstat (limited to 'modules/gdscript/tests/test_gdscript.cpp')
-rw-r--r--modules/gdscript/tests/test_gdscript.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/modules/gdscript/tests/test_gdscript.cpp b/modules/gdscript/tests/test_gdscript.cpp
index a909f216ee..68d9984b43 100644
--- a/modules/gdscript/tests/test_gdscript.cpp
+++ b/modules/gdscript/tests/test_gdscript.cpp
@@ -35,10 +35,6 @@
#include "core/os/os.h"
#include "core/string_builder.h"
-#include "modules/modules_enabled.gen.h"
-
-#ifdef MODULE_GDSCRIPT_ENABLED
-
#include "modules/gdscript/gdscript_analyzer.h"
#include "modules/gdscript/gdscript_compiler.h"
#include "modules/gdscript/gdscript_parser.h"
@@ -183,21 +179,21 @@ static void test_compiler(const String &p_code, const String &p_script_path, con
}
}
-MainLoop *test(TestType p_type) {
+void test(TestType p_type) {
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
if (cmdlargs.empty()) {
- return nullptr;
+ return;
}
String test = cmdlargs.back()->get();
if (!test.ends_with(".gd")) {
print_line("This test expects a path to a GDScript file as its last parameter. Got: " + test);
- return nullptr;
+ return;
}
FileAccessRef fa = FileAccess::open(test, FileAccess::READ);
- ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test);
+ ERR_FAIL_COND_MSG(!fa, "Could not open file: " + test);
Vector<uint8_t> buf;
int flen = fa->get_len();
@@ -230,21 +226,6 @@ MainLoop *test(TestType p_type) {
case TEST_BYTECODE:
print_line("Not implemented.");
}
-
- return nullptr;
-}
-
-} // namespace TestGDScript
-
-#else
-
-namespace TestGDScript {
-
-MainLoop *test(TestType p_type) {
- ERR_PRINT("The GDScript module is disabled, therefore GDScript tests cannot be used.");
- return nullptr;
}
} // namespace TestGDScript
-
-#endif