From 0cc05c5a31b6c6d3db76b5982f3f36919e137500 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Tue, 18 Aug 2020 17:24:45 +0300 Subject: Register GDScript test tools as test commands to run via command-line --- modules/gdscript/tests/test_gdscript.cpp | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'modules/gdscript/tests/test_gdscript.cpp') 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 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 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 -- cgit v1.2.3