Skip to content

Commit 0285eee

Browse files
Update testtokenize.cpp
1 parent 23ccf81 commit 0285eee

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎test/testtokenize.cpp‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ class TestTokenizer : public TestFixture {
240240
TEST_CASE(vardecl33);
241241
TEST_CASE(vardecl34);
242242
TEST_CASE(vardecl35);
243+
TEST_CASE(vardecl36);
243244
TEST_CASE(vardecl_stl_1);
244245
TEST_CASE(vardecl_stl_2);
245246
TEST_CASE(vardecl_stl_3);
@@ -3035,6 +3036,28 @@ class TestTokenizer : public TestFixture {
30353036
}
30363037
}
30373038

3039+
void vardecl36() {
3040+
const char code[] = "struct S {\n"
3041+
" bool f() const;\n"
3042+
" int g() const;\n"
3043+
" int x, y;\n"
3044+
"};\n"
3045+
"bool S::f() const {\n"
3046+
" const bool b = x ? g() < 0 : 0 > y;\n"
3047+
" return b;\n"
3048+
"}\n";
3049+
const char expected[] = "struct S {\n"
3050+
"bool f ( ) const ;\n"
3051+
"int g ( ) const ;\n"
3052+
"int x ; int y ;\n"
3053+
"} ;\n"
3054+
"bool S :: f ( ) const {\n"
3055+
"const bool b = x ? ( g ( ) < 0 ) : 0 > y ;\n"
3056+
"return b ;\n"
3057+
"}";
3058+
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
3059+
}
3060+
30383061
void volatile_variables() {
30393062
{
30403063
const char code[] = "volatile int a=0;\n"

0 commit comments

Comments
 (0)