Skip to content

Commit effb04e

Browse files
committed
Add test
1 parent 1def032 commit effb04e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/testtokenize.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ class TestTokenizer : public TestFixture {
292292

293293
TEST_CASE(attributeAlignasBefore);
294294
TEST_CASE(attributeAlignasAfter);
295+
TEST_CASE(simplifyAlignedStorage);
295296

296297
TEST_CASE(splitTemplateRightAngleBrackets);
297298

@@ -4380,6 +4381,21 @@ class TestTokenizer : public TestFixture {
43804381
ASSERT_EQUALS(var->getAttributeAlignas()[0], "long");
43814382
}
43824383

4384+
void simplifyAlignedStorage() {
4385+
const char code[] = "std::aligned_storage<sizeof(long), alignof(long)>::type buffer;";
4386+
const char expected[] = "std :: aligned_storage < sizeof ( long ) , alignof ( long ) > :: type buffer ;";
4387+
4388+
SimpleTokenizer tokenizer(settings2, *this);
4389+
ASSERT(tokenizer.tokenize(code));
4390+
4391+
ASSERT_EQUALS(expected, tokenizer.tokens()->stringifyList(nullptr, false));
4392+
4393+
const Token *buffer = Token::findsimplematch(tokenizer.tokens(), "buffer");
4394+
ASSERT(buffer);
4395+
ASSERT(buffer->hasAttributeAlignas());
4396+
ASSERT_EQUALS("alignof ( long )", buffer->getAttributeAlignas()[0]);
4397+
}
4398+
43834399
void splitTemplateRightAngleBrackets() {
43844400
{
43854401
const char code[] = "; z = x < 0 ? x >> y : x >> y;";

0 commit comments

Comments
 (0)