Skip to content

Commit 6f11ac2

Browse files
committed
Fixup test cases
1 parent 4a11e4d commit 6f11ac2

File tree

1 file changed

+36
-28
lines changed

1 file changed

+36
-28
lines changed

clang/unittests/Format/FormatTest.cpp

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15348,7 +15348,7 @@ TEST_F(FormatTest, NeverMergeShortRecords) {
1534815348
}
1534915349

1535015350
TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
15351-
FormatStyle Style = getLLVMStyle();
15351+
auto Style = getLLVMStyle();
1535215352

1535315353
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
1535415354
Style.BraceWrapping.SplitEmptyRecord = false;
@@ -15358,7 +15358,9 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
1535815358
" void bar();\n"
1535915359
"};",
1536015360
Style);
15361-
verifyFormat("class foo {\n};", Style);
15361+
verifyFormat("class foo {\n"
15362+
"};",
15363+
Style);
1536215364

1536315365
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_EmptyIfAttached;
1536415366
verifyFormat("class foo {\n"
@@ -15379,25 +15381,26 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
1537915381
verifyFormat("class foo {};", Style);
1538015382

1538115383
Style.BraceWrapping.AfterClass = true;
15382-
Style.BraceWrapping.AfterStruct = true;
15383-
Style.BraceWrapping.AfterUnion = true;
1538415384

1538515385
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never;
15386-
verifyFormat("class foo\n{\n"
15386+
verifyFormat("class foo\n"
15387+
"{\n"
1538715388
" void bar();\n"
1538815389
"};",
1538915390
Style);
1539015391
verifyFormat("class foo\n{};", Style);
1539115392

1539215393
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_EmptyIfAttached;
15393-
verifyFormat("class foo\n{\n"
15394+
verifyFormat("class foo\n"
15395+
"{\n"
1539415396
" void bar();\n"
1539515397
"};",
1539615398
Style);
1539715399
verifyFormat("class foo\n{};", Style);
1539815400

1539915401
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Empty;
15400-
verifyFormat("class foo\n{\n"
15402+
verifyFormat("class foo\n"
15403+
"{\n"
1540115404
" void bar();\n"
1540215405
"};",
1540315406
Style);
@@ -15409,24 +15412,26 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
1540915412
}
1541015413

1541115414
TEST_F(FormatTest, AllowShortRecordOnASingleLineSplit) {
15412-
FormatStyle Style = getLLVMStyle();
15415+
auto Style = getLLVMStyle();
1541315416

15414-
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
15415-
Style.BraceWrapping.SplitEmptyRecord = true;
15417+
EXPECT_EQ(Style.BraceWrapping.SplitEmptyRecord, true);
1541615418

15417-
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never;
15419+
EXPECT_EQ(Style.AllowShortRecordOnASingleLine,
15420+
FormatStyle::SRS_EmptyIfAttached);
1541815421
verifyFormat("class foo {\n"
1541915422
" void bar();\n"
1542015423
"};",
1542115424
Style);
15422-
verifyFormat("class foo {\n};", Style);
15425+
verifyFormat("class foo {};", Style);
1542315426

15424-
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_EmptyIfAttached;
15427+
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never;
1542515428
verifyFormat("class foo {\n"
1542615429
" void bar();\n"
1542715430
"};",
1542815431
Style);
15429-
verifyFormat("class foo {};", Style);
15432+
verifyFormat("class foo {\n"
15433+
"};",
15434+
Style);
1543015435

1543115436
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Empty;
1543215437
verifyFormat("class foo {\n"
@@ -15439,29 +15444,32 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineSplit) {
1543915444
verifyFormat("class foo { void bar(); };", Style);
1544015445
verifyFormat("class foo {};", Style);
1544115446

15447+
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
1544215448
Style.BraceWrapping.AfterClass = true;
15443-
Style.BraceWrapping.AfterStruct = true;
15444-
Style.BraceWrapping.AfterUnion = true;
1544515449

1544615450
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never;
15447-
verifyFormat("class foo\n{\n}", Style);
15448-
verifyFormat("struct foo\n{\n}", Style);
15449-
verifyFormat("union foo\n{\n}", Style);
15451+
verifyFormat("class foo\n"
15452+
"{\n"
15453+
"}",
15454+
Style);
1545015455

1545115456
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_EmptyIfAttached;
15452-
verifyFormat("class foo\n{\n}", Style);
15453-
verifyFormat("struct foo\n{\n}", Style);
15454-
verifyFormat("union foo\n{\n}", Style);
15457+
verifyFormat("class foo\n"
15458+
"{\n"
15459+
"}",
15460+
Style);
1545515461

1545615462
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Empty;
15457-
verifyFormat("class foo\n{\n}", Style);
15458-
verifyFormat("struct foo\n{\n}", Style);
15459-
verifyFormat("union foo\n{\n}", Style);
15463+
verifyFormat("class foo\n"
15464+
"{\n"
15465+
"}",
15466+
Style);
1546015467

1546115468
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Always;
15462-
verifyFormat("class foo\n{\n}", Style);
15463-
verifyFormat("struct foo\n{\n}", Style);
15464-
verifyFormat("union foo\n{\n}", Style);
15469+
verifyFormat("class foo\n"
15470+
"{\n"
15471+
"}",
15472+
Style);
1546515473
}
1546615474

1546715475
TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) {

0 commit comments

Comments
 (0)