Skip to content

Commit

Permalink
[Tests] Add check for argument name validity
Browse files Browse the repository at this point in the history
Checks that all method and signal arguments have valid names
  • Loading branch information
AThousandShips committed Aug 16, 2024
1 parent 96be44c commit 2f6e0fe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/core/object/test_class_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,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_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);
Expand Down

0 comments on commit 2f6e0fe

Please sign in to comment.