Skip to content

Commit 6c8cfd3

Browse files
committed
add test
1 parent 3181f13 commit 6c8cfd3

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/testsymboldatabase.cpp

Lines changed: 16 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,21 @@ 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+
const auto it = db->functionScopes.cbegin();
3074+
const Function *func = (*it)->function;
3075+
ASSERT_EQUALS("ext_func", func->name());
3076+
ASSERT_EQUALS(2, func->argCount());
3077+
const Variable *arg = func->getArgumentVar(0);
3078+
ASSERT_EQUALS("cb", arg->name());
3079+
arg = func->getArgumentVar(1);
3080+
ASSERT_EQUALS("v", arg->name());
3081+
}
3082+
30673083
void functionImplicitlyVirtual() {
30683084
GET_SYMBOL_DB("class base { virtual void f(); };\n"
30693085
"class derived : base { void f(); };\n"

0 commit comments

Comments
 (0)