diff options
author | Yuri Sizov <yuris@humnom.net> | 2022-08-08 15:18:26 +0300 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2022-08-08 16:36:01 +0300 |
commit | 1362bc22bd636190dfaf6876fbec86e2cd7a34b7 (patch) | |
tree | 5d7100b67adca69e3cf5b451839f051499395404 /modules/gdscript | |
parent | beceba85da9d53dad33c1a0d3f59c24e966b1c35 (diff) |
Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/tests/gdscript_test_runner_suite.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/gdscript/tests/gdscript_test_runner_suite.h b/modules/gdscript/tests/gdscript_test_runner_suite.h index 0722fb800e..90f6d7f7e8 100644 --- a/modules/gdscript/tests/gdscript_test_runner_suite.h +++ b/modules/gdscript/tests/gdscript_test_runner_suite.h @@ -69,6 +69,40 @@ func _init(): CHECK_MESSAGE(int(ref_counted->get_meta("result")) == 42, "The script should assign object metadata successfully."); } +TEST_CASE("[Modules][GDScript] Validate built-in API") { + GDScriptLanguage *lang = GDScriptLanguage::get_singleton(); + + // Validate methods. + List<MethodInfo> builtin_methods; + lang->get_public_functions(&builtin_methods); + + 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)); + } + } + } + + // Validate annotations. + List<MethodInfo> builtin_annotations; + lang->get_public_annotations(&builtin_annotations); + + 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)); + } + } + } +} + } // namespace GDScriptTests #endif // GDSCRIPT_TEST_RUNNER_SUITE_H |