diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-08 19:15:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-08 19:15:07 +0200 |
commit | bc3ab0aaa86e88d12300c3939b23bef0def02105 (patch) | |
tree | 7515b1d4b684813e0d133d857c1a3ffb931d738f /modules/gdscript | |
parent | 68cffc593130cae0ca8295168c51d2656162d833 (diff) | |
parent | 1362bc22bd636190dfaf6876fbec86e2cd7a34b7 (diff) |
Merge pull request #64004 from YuriSizov/doctool-fail-on-unnamed-args
Add checks and tests for empty/unnamed arguments
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 |