diff options
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r-- | modules/gdscript/tests/gdscript_test_runner.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/tests/gdscript_test_runner_suite.h | 18 | ||||
-rw-r--r-- | modules/gdscript/tests/test_gdscript.cpp | 6 |
3 files changed, 13 insertions, 15 deletions
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp index e3d16eaf42..a949c44d78 100644 --- a/modules/gdscript/tests/gdscript_test_runner.cpp +++ b/modules/gdscript/tests/gdscript_test_runner.cpp @@ -573,7 +573,7 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) { const List<GDScriptParser::ParserError> &errors = parser.get_errors(); if (!errors.is_empty()) { // Only the first error since the following might be cascading. - result.output += errors[0].message + "\n"; // TODO: line, column? + result.output += errors.front()->get().message + "\n"; // TODO: line, column? } if (!p_is_generating) { result.passed = check_output(result.output); @@ -592,7 +592,7 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) { const List<GDScriptParser::ParserError> &errors = parser.get_errors(); if (!errors.is_empty()) { // Only the first error since the following might be cascading. - result.output += errors[0].message + "\n"; // TODO: line, column? + result.output += errors.front()->get().message + "\n"; // TODO: line, column? } if (!p_is_generating) { result.passed = check_output(result.output); diff --git a/modules/gdscript/tests/gdscript_test_runner_suite.h b/modules/gdscript/tests/gdscript_test_runner_suite.h index b2289ef9cc..d6befd2db3 100644 --- a/modules/gdscript/tests/gdscript_test_runner_suite.h +++ b/modules/gdscript/tests/gdscript_test_runner_suite.h @@ -81,11 +81,10 @@ TEST_CASE("[Modules][GDScript] Validate built-in API") { SUBCASE("[Modules][GDScript] Validate built-in methods") { for (const MethodInfo &mi : builtin_methods) { - for (int j = 0; j < mi.arguments.size(); j++) { - PropertyInfo arg = mi.arguments[j]; - - TEST_COND((arg.name.is_empty() || arg.name.begins_with("_unnamed_arg")), - vformat("Unnamed argument in position %d of built-in method '%s'.", j, mi.name)); + int i = 0; + for (List<PropertyInfo>::ConstIterator itr = mi.arguments.begin(); itr != mi.arguments.end(); ++itr, ++i) { + TEST_COND((itr->name.is_empty() || itr->name.begins_with("_unnamed_arg")), + vformat("Unnamed argument in position %d of built-in method '%s'.", i, mi.name)); } } } @@ -96,11 +95,10 @@ TEST_CASE("[Modules][GDScript] Validate built-in API") { SUBCASE("[Modules][GDScript] Validate built-in annotations") { for (const MethodInfo &ai : builtin_annotations) { - for (int j = 0; j < ai.arguments.size(); j++) { - PropertyInfo arg = ai.arguments[j]; - - TEST_COND((arg.name.is_empty() || arg.name.begins_with("_unnamed_arg")), - vformat("Unnamed argument in position %d of built-in annotation '%s'.", j, ai.name)); + int i = 0; + for (List<PropertyInfo>::ConstIterator itr = ai.arguments.begin(); itr != ai.arguments.end(); ++itr, ++i) { + TEST_COND((itr->name.is_empty() || itr->name.begins_with("_unnamed_arg")), + vformat("Unnamed argument in position %d of built-in annotation '%s'.", i, ai.name)); } } } diff --git a/modules/gdscript/tests/test_gdscript.cpp b/modules/gdscript/tests/test_gdscript.cpp index f6965cf7cf..fbc72a0508 100644 --- a/modules/gdscript/tests/test_gdscript.cpp +++ b/modules/gdscript/tests/test_gdscript.cpp @@ -188,11 +188,11 @@ static void recursively_disassemble_functions(const Ref<GDScript> script, const const MethodInfo &mi = func->get_method_info(); String signature = "Disassembling " + mi.name + "("; - for (int i = 0; i < mi.arguments.size(); i++) { - if (i > 0) { + for (List<PropertyInfo>::ConstIterator arg_itr = mi.arguments.begin(); arg_itr != mi.arguments.end(); ++arg_itr) { + if (arg_itr != mi.arguments.begin()) { signature += ", "; } - signature += mi.arguments[i].name; + signature += arg_itr->name; } print_line(signature + ")"); #ifdef TOOLS_ENABLED |