Skip to content

Commit 9c9cf90

Browse files
committed
add test
1 parent 3181f13 commit 9c9cf90

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/testsymboldatabase.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ class TestSymbolDatabase : public TestFixture {
304304
TEST_CASE(functionArgs19); // #10376
305305
TEST_CASE(functionArgs20);
306306
TEST_CASE(functionArgs21);
307+
TEST_CASE(functionArgs22); // #13945
307308

308309
TEST_CASE(functionImplicitlyVirtual);
309310
TEST_CASE(functionGetOverridden);
@@ -3064,6 +3065,22 @@ class TestSymbolDatabase : public TestFixture {
30643065
ASSERT_EQUALS("", arg->name());
30653066
}
30663067

3068+
void functionArgs22() {
3069+
const char code[] = "typedef void (*callback_fn)(void);\n"
3070+
"void ext_func(const callback_fn cb, size_t v) {}\n";
3071+
GET_SYMBOL_DB(code);
3072+
ASSERT(db != nullptr);
3073+
ASSERT_EQUALS(1U, db->functionScopes.size());
3074+
const auto it = db->functionScopes.cbegin();
3075+
const Function *func = (*it)->function;
3076+
ASSERT_EQUALS("ext_func", func->name());
3077+
ASSERT_EQUALS(2, func->argCount());
3078+
const Variable *arg = func->getArgumentVar(0);
3079+
ASSERT_EQUALS("cb", arg->name());
3080+
arg = func->getArgumentVar(1);
3081+
ASSERT_EQUALS("v", arg->name());
3082+
}
3083+
30673084
void functionImplicitlyVirtual() {
30683085
GET_SYMBOL_DB("class base { virtual void f(); };\n"
30693086
"class derived : base { void f(); };\n"

0 commit comments

Comments
 (0)