diff options
Diffstat (limited to 'modules/gdscript/tests/gdscript_test_runner.cpp')
| -rw-r--r-- | modules/gdscript/tests/gdscript_test_runner.cpp | 23 | 
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp index e78517a708..e3b956369d 100644 --- a/modules/gdscript/tests/gdscript_test_runner.cpp +++ b/modules/gdscript/tests/gdscript_test_runner.cpp @@ -36,6 +36,7 @@  #include "../gdscript_parser.h"  #include "core/config/project_settings.h" +#include "core/core_globals.h"  #include "core/core_string_names.h"  #include "core/io/dir_access.h"  #include "core/io/file_access_pack.h" @@ -48,11 +49,11 @@  namespace GDScriptTests {  void init_autoloads() { -	OrderedHashMap<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list(); +	HashMap<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();  	// First pass, add the constants so they exist before any script is loaded. -	for (OrderedHashMap<StringName, ProjectSettings::AutoloadInfo>::Element E = autoloads.front(); E; E = E.next()) { -		const ProjectSettings::AutoloadInfo &info = E.get(); +	for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : ProjectSettings::get_singleton()->get_autoload_list()) { +		const ProjectSettings::AutoloadInfo &info = E.value;  		if (info.is_singleton) {  			for (int i = 0; i < ScriptServer::get_language_count(); i++) { @@ -62,15 +63,15 @@ void init_autoloads() {  	}  	// Second pass, load into global constants. -	for (OrderedHashMap<StringName, ProjectSettings::AutoloadInfo>::Element E = autoloads.front(); E; E = E.next()) { -		const ProjectSettings::AutoloadInfo &info = E.get(); +	for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : ProjectSettings::get_singleton()->get_autoload_list()) { +		const ProjectSettings::AutoloadInfo &info = E.value;  		if (!info.is_singleton) {  			// Skip non-singletons since we don't have a scene tree here anyway.  			continue;  		} -		RES res = ResourceLoader::load(info.path); +		Ref<Resource> res = ResourceLoader::load(info.path);  		ERR_CONTINUE_MSG(res.is_null(), "Can't autoload: " + info.path);  		Node *n = nullptr;  		Ref<PackedScene> scn = res; @@ -142,8 +143,8 @@ GDScriptTestRunner::GDScriptTestRunner(const String &p_source_dir, bool p_init_l  #endif  	// Enable printing to show results -	_print_line_enabled = true; -	_print_error_enabled = true; +	CoreGlobals::print_line_enabled = true; +	CoreGlobals::print_error_enabled = true;  }  GDScriptTestRunner::~GDScriptTestRunner() { @@ -363,7 +364,7 @@ void GDScriptTest::disable_stdout() {  	OS::get_singleton()->set_stderr_enabled(false);  } -void GDScriptTest::print_handler(void *p_this, const String &p_message, bool p_error) { +void GDScriptTest::print_handler(void *p_this, const String &p_message, bool p_error, bool p_rich) {  	TestResult *result = (TestResult *)p_this;  	result->output += p_message + "\n";  } @@ -543,8 +544,8 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) {  		return result;  	}  	// Test running. -	const Map<StringName, GDScriptFunction *>::Element *test_function_element = script->get_member_functions().find(GDScriptTestRunner::test_function_name); -	if (test_function_element == nullptr) { +	const HashMap<StringName, GDScriptFunction *>::ConstIterator test_function_element = script->get_member_functions().find(GDScriptTestRunner::test_function_name); +	if (!test_function_element) {  		enable_stdout();  		result.status = GDTEST_LOAD_ERROR;  		result.output = "";  |