@@ -15348,7 +15348,7 @@ TEST_F(FormatTest, NeverMergeShortRecords) {
15348
15348
}
15349
15349
15350
15350
TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
15351
- FormatStyle Style = getLLVMStyle();
15351
+ auto Style = getLLVMStyle();
15352
15352
15353
15353
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
15354
15354
Style.BraceWrapping.SplitEmptyRecord = false;
@@ -15358,7 +15358,9 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
15358
15358
" void bar();\n"
15359
15359
"};",
15360
15360
Style);
15361
- verifyFormat("class foo {\n};", Style);
15361
+ verifyFormat("class foo {\n"
15362
+ "};",
15363
+ Style);
15362
15364
15363
15365
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_EmptyIfAttached;
15364
15366
verifyFormat("class foo {\n"
@@ -15379,25 +15381,26 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
15379
15381
verifyFormat("class foo {};", Style);
15380
15382
15381
15383
Style.BraceWrapping.AfterClass = true;
15382
- Style.BraceWrapping.AfterStruct = true;
15383
- Style.BraceWrapping.AfterUnion = true;
15384
15384
15385
15385
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never;
15386
- verifyFormat("class foo\n{\n"
15386
+ verifyFormat("class foo\n"
15387
+ "{\n"
15387
15388
" void bar();\n"
15388
15389
"};",
15389
15390
Style);
15390
15391
verifyFormat("class foo\n{};", Style);
15391
15392
15392
15393
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_EmptyIfAttached;
15393
- verifyFormat("class foo\n{\n"
15394
+ verifyFormat("class foo\n"
15395
+ "{\n"
15394
15396
" void bar();\n"
15395
15397
"};",
15396
15398
Style);
15397
15399
verifyFormat("class foo\n{};", Style);
15398
15400
15399
15401
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Empty;
15400
- verifyFormat("class foo\n{\n"
15402
+ verifyFormat("class foo\n"
15403
+ "{\n"
15401
15404
" void bar();\n"
15402
15405
"};",
15403
15406
Style);
@@ -15409,24 +15412,26 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineNonSplit) {
15409
15412
}
15410
15413
15411
15414
TEST_F(FormatTest, AllowShortRecordOnASingleLineSplit) {
15412
- FormatStyle Style = getLLVMStyle();
15415
+ auto Style = getLLVMStyle();
15413
15416
15414
- Style.BreakBeforeBraces = FormatStyle::BS_Custom;
15415
- Style.BraceWrapping.SplitEmptyRecord = true;
15417
+ EXPECT_EQ(Style.BraceWrapping.SplitEmptyRecord, true);
15416
15418
15417
- Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never;
15419
+ EXPECT_EQ(Style.AllowShortRecordOnASingleLine,
15420
+ FormatStyle::SRS_EmptyIfAttached);
15418
15421
verifyFormat("class foo {\n"
15419
15422
" void bar();\n"
15420
15423
"};",
15421
15424
Style);
15422
- verifyFormat("class foo {\n };", Style);
15425
+ verifyFormat("class foo {};", Style);
15423
15426
15424
- Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_EmptyIfAttached ;
15427
+ Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never ;
15425
15428
verifyFormat("class foo {\n"
15426
15429
" void bar();\n"
15427
15430
"};",
15428
15431
Style);
15429
- verifyFormat("class foo {};", Style);
15432
+ verifyFormat("class foo {\n"
15433
+ "};",
15434
+ Style);
15430
15435
15431
15436
Style.AllowShortRecordOnASingleLine = FormatStyle::SRS_Empty;
15432
15437
verifyFormat("class foo {\n"
@@ -15439,29 +15444,32 @@ TEST_F(FormatTest, AllowShortRecordOnASingleLineSplit) {
15439
15444
verifyFormat("class foo { void bar(); };", Style);
15440
15445
verifyFormat("class foo {};", Style);
15441
15446
15447
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
15442
15448
Style.BraceWrapping.AfterClass = true;
15443
- Style.BraceWrapping.AfterStruct = true;
15444
- Style.BraceWrapping.AfterUnion = true;
15445
15449
15446
15450
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);
15450
15455
15451
15456
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);
15455
15461
15456
15462
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);
15460
15467
15461
15468
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);
15465
15473
}
15466
15474
15467
15475
TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) {
0 commit comments