Skip to content

Commit

Permalink
Update testsimplifytokens.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Apr 5, 2024
1 parent 1a62fc8 commit 929eb03
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions test/testsimplifytokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,24 +1252,39 @@ class TestSimplifyTokens : public TestFixture {
}

void simplifyStructDecl9() {
const char* code = "enum E : int;\n" // #12588
"void f() {}\n"
"namespace {\n"
" struct S {\n"
" explicit S(int i) : m(i) {}\n"
" int m;\n"
" };\n"
"}\n"
"void g() { S s(0); }\n";
const char* exp = "enum E : int ; "
"void f ( ) { } "
"namespace { "
"struct S { "
"explicit S ( int i ) : m ( i ) { } "
"int m ; "
"} ; "
"} "
"void g ( ) { S s ( 0 ) ; }";
const char *code{}, *exp{};
code = "enum E : int;\n" // #12588
"void f() {}\n"
"namespace {\n"
" struct S {\n"
" explicit S(int i) : m(i) {}\n"
" int m;\n"
" };\n"
"}\n"
"void g() { S s(0); }\n";
exp = "enum E : int ; "
"void f ( ) { } "
"namespace { "
"struct S { "
"explicit S ( int i ) : m ( i ) { } "
"int m ; "
"} ; "
"} "
"void g ( ) { S s ( 0 ) ; }";
ASSERT_EQUALS(exp, tok(code));

code = "struct S {\n" // 12595
" explicit S() {\n"
" e = E1;\n"
" }\n"
" enum { E1 } e = E1;\n"
"};\n";
exp = "struct S { "
"explicit S ( ) { e = E1 ; } "
"enum Anonymous0 { E1 } ; "
"enum Anonymous0 e ; "
"e = E1 ; "
"} ;";
ASSERT_EQUALS(exp, tok(code));
}

Expand Down

0 comments on commit 929eb03

Please sign in to comment.