Skip to content

Commit 1822db9

Browse files
committed
add test
1 parent 2d9f673 commit 1822db9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/testtokenize.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ class TestTokenizer : public TestFixture {
464464
TEST_CASE(funcnameInParenthesis1); // #13554
465465
TEST_CASE(funcnameInParenthesis2); // #13578
466466
TEST_CASE(funcnameInParenthesis3); // #13585
467+
468+
TEST_CASE(genericInIf); // #13561
467469
}
468470

469471
#define tokenizeAndStringify(...) tokenizeAndStringify_(__FILE__, __LINE__, __VA_ARGS__)
@@ -8389,6 +8391,12 @@ class TestTokenizer : public TestFixture {
83898391
ASSERT_EQUALS(par->astOperand1(), f->astParent() /* :: */);
83908392
ASSERT(Token::simpleMatch(par->astOperand2(), ","));
83918393
}
8394+
8395+
void genericInIf() { // #13561
8396+
const char code[] = " if (_Generic(s, char * : 1, const float * : 2, volatile int * : 3, default : 0)) {}";
8397+
const char ast[] = "(( if (( _Generic (, (, (, (, s (: char 1)) (: float 2)) (: int 3)) (: default 0))))";
8398+
ASSERT_EQUALS(ast, testAst(code, AstStyle::Z3));
8399+
}
83928400
};
83938401

83948402
REGISTER_TEST(TestTokenizer)

0 commit comments

Comments
 (0)