Skip to content

Commit

Permalink
Update testsimplifytypedef.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Apr 16, 2024
1 parent 0723235 commit 12bf724
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions test/testsimplifytypedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class TestSimplifyTypedef : public TestFixture {
TEST_CASE(simplifyTypedef148);
TEST_CASE(simplifyTypedef149);
TEST_CASE(simplifyTypedef150);
TEST_CASE(simplifyTypedef151);
TEST_CASE(simplifyTypedef152);

TEST_CASE(simplifyTypedefFunction1);
Expand Down Expand Up @@ -3531,16 +3532,33 @@ class TestSimplifyTypedef : public TestFixture {
ASSERT_EQUALS(exp, tok(code));
}

void simplifyTypedef151() {
const char* code{}, *exp{};
code = "namespace N {\n" // #12597
" typedef int T[10];\n"
" const T* f() { return static_cast<const T*>(nullptr); }\n"
"}\n";
exp = "namespace N { "
"const int ( * f ( ) ) [ 10 ] { return static_cast < const int ( * ) [ 10 ] > ( nullptr ) ; } "
"}";
ASSERT_EQUALS(exp, tok(code));
}

void simplifyTypedef152() {
const char* code{}, *exp{};
code = "namespace O { struct T {}; }\n"
"typedef O::T S;\n"
"namespace N {\n"
"namespace M {\n"
" enum E { E0, S = 1 };\n"
"}\n";
" enum class F : ::std::int8_t { F0, S = 1 };\n"
"}\n"
"namespace N { enum { G0, S = 1 }; }\n";
exp = "namespace O { struct T { } ; } "
"namespace N { "
"namespace M { "
"enum E { E0 , S = 1 } ; "
"enum class F : :: std :: int8_t { F0 , S = 1 } ; "
"}"
" namespace N { enum Anonymous0 { G0 , S = 1 } ; "
"}";
ASSERT_EQUALS(exp, tok(code));
}
Expand Down

0 comments on commit 12bf724

Please sign in to comment.