Merge pull request #44398 from RevoluPowered/unit-tests-for-export-templates

Add unit tests for export templates
This commit is contained in:
Rémi Verschelde 2021-03-23 00:42:29 +01:00 committed by GitHub
commit eeba8d63f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -302,10 +302,6 @@ if env_base["target"] == "debug":
# http://scons.org/doc/production/HTML/scons-user/ch06s04.html # http://scons.org/doc/production/HTML/scons-user/ch06s04.html
env_base.SetOption("implicit_cache", 1) env_base.SetOption("implicit_cache", 1)
if not env_base["tools"]:
# Export templates can't run unit test tool.
env_base["tests"] = False
if env_base["no_editor_splash"]: if env_base["no_editor_splash"]:
env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"]) env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"])

View File

@ -118,10 +118,10 @@ static void test_parser(const String &p_code, const String &p_script_path, const
print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message)); print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message));
} }
} }
#ifdef TOOLS_ENABLED
GDScriptParser::TreePrinter printer; GDScriptParser::TreePrinter printer;
printer.print_tree(parser); printer.print_tree(parser);
#endif
} }
static void test_compiler(const String &p_code, const String &p_script_path, const Vector<String> &p_lines) { static void test_compiler(const String &p_code, const String &p_script_path, const Vector<String> &p_lines) {
@ -175,8 +175,9 @@ static void test_compiler(const String &p_code, const String &p_script_path, con
signature += func->get_argument_name(i); signature += func->get_argument_name(i);
} }
print_line(signature + ")"); print_line(signature + ")");
#ifdef TOOLS_ENABLED
func->disassemble(p_lines); func->disassemble(p_lines);
#endif
print_line(""); print_line("");
print_line(""); print_line("");
} }

View File

@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifdef TOOLS_ENABLED
#ifndef TEST_TEXT_SERVER_H #ifndef TEST_TEXT_SERVER_H
#define TEST_TEXT_SERVER_H #define TEST_TEXT_SERVER_H
@ -247,3 +249,4 @@ TEST_SUITE("[[TextServer]") {
}; // namespace TestTextServer }; // namespace TestTextServer
#endif // TEST_TEXT_SERVER_H #endif // TEST_TEXT_SERVER_H
#endif // TOOLS_ENABLED