Skip to content

Commit 84bb93c

Browse files
committed
add test
1 parent ddd1f55 commit 84bb93c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎test/testsimplifytypedef.cpp‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ class TestSimplifyTypedef : public TestFixture {
254254
TEST_CASE(simplifyTypedefShadow); // #4445 - shadow variable
255255

256256
TEST_CASE(simplifyTypedefMacro);
257+
TEST_CASE(simplifyTypedefMacroName);
257258

258259
TEST_CASE(simplifyTypedefOriginalName1);
259260
TEST_CASE(simplifyTypedefOriginalName2);
@@ -4547,6 +4548,16 @@ class TestSimplifyTypedef : public TestFixture {
45474548
simplifyTypedefP(code));
45484549
}
45494550

4551+
void simplifyTypedefMacroName() {
4552+
const char code[] = "#define A int\n"
4553+
"typedef void (*F)(A x);\n"
4554+
"void f(F g);\n";
4555+
SimpleTokenizer2 tokenizer(settings0, *this, code, "test.c");
4556+
tokenizer.createLinks();
4557+
tokenizer.simplifyTypedef();
4558+
ASSERT_EQUALS("void f ( void ( * g ) ( $int x ) ) ;", tokenizer.tokens()->stringifyList(false, true, false, false, false));
4559+
}
4560+
45504561
void simplifyTypedefOriginalName1() {
45514562
const char code[] = "typedef unsigned char uint8_t;\n"
45524563
"typedef float (*rFunctionPointer_fp)(uint8_t, uint8_t);\n"

0 commit comments

Comments
 (0)