From 7c84aa11014227c245306379bcbb8280083dc65e Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 14 Jun 2021 10:43:51 +0200 Subject: Validate that all virtual methods start with _ --- tests/test_class_db.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_class_db.h b/tests/test_class_db.h index fe2ed696c5..75785fa5ed 100644 --- a/tests/test_class_db.h +++ b/tests/test_class_db.h @@ -665,7 +665,7 @@ void add_exposed_classes(Context &r_context) { TEST_COND(exposed_class.find_property_by_name(method.name), "Method name conflicts with property: '", String(class_name), ".", String(method.name), "'."); - // Classes starting with an underscore are ignored unless they're used as a property setter or getter + // Methods starting with an underscore are ignored unless they're virtual or used as a property setter or getter. if (!method.is_virtual && String(method.name)[0] == '_') { for (const List::Element *F = exposed_class.properties.front(); F; F = F->next()) { const PropertyData &prop = F->get(); @@ -678,6 +678,10 @@ void add_exposed_classes(Context &r_context) { } else { exposed_class.methods.push_back(method); } + + if (method.is_virtual) { + TEST_COND(String(method.name)[0] != '_', "Virtual method ", String(method.name), " does not start with underscore."); + } } // Add signals -- cgit v1.2.3