From 32433aef1ff14a9c2a3c0a2eacc1d2066b673fe3 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:01:03 +0200 Subject: [PATCH] [Tests] Add check for argument name validity Checks that all method and signal arguments have valid names --- tests/core/object/test_class_db.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.h index 924e93129dcc..6fc18a46c913 100644 --- a/tests/core/object/test_class_db.h +++ b/tests/core/object/test_class_db.h @@ -415,6 +415,9 @@ void validate_argument(const Context &p_context, const ExposedClass &p_class, co #ifdef DEBUG_METHODS_ENABLED TEST_COND((p_arg.name.is_empty() || p_arg.name.begins_with("_unnamed_arg")), vformat("Unnamed argument in position %d of %s '%s.%s'.", p_arg.position, p_owner_type, p_class.name, p_owner_name)); + + TEST_FAIL_COND((p_arg.name != "@varargs@" && !p_arg.name.is_valid_ascii_identifier()), + vformat("Invalid argument name '%s' of %s '%s.%s'.", p_arg.name, p_owner_type, p_class.name, p_owner_name)); #endif // DEBUG_METHODS_ENABLED const ExposedClass *arg_class = p_context.find_exposed_class(p_arg.type);