Skip to content

Commit cd21d84

Browse files
Add config parse test
1 parent f4be7c7 commit cd21d84

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

clang/include/clang/Format/Format.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,6 +3270,9 @@ struct FormatStyle {
32703270
Hex == R.Hex && HexMinDigits == R.HexMinDigits &&
32713271
HexMaxDigitsNoSeparator == R.HexMaxDigitsNoSeparator;
32723272
}
3273+
bool operator!=(const IntegerLiteralSeparatorStyle &R) const {
3274+
return !operator==(R);
3275+
}
32733276
};
32743277

32753278
/// Format integer literal separators (``'`` for C++ and ``_`` for C#, Java,

clang/unittests/Format/ConfigParseTest.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,28 @@ TEST(ConfigParseTest, ParsesConfiguration) {
11501150
FormatStyle::BLS_Block);
11511151
CHECK_PARSE("Cpp11BracedListStyle: true", Cpp11BracedListStyle,
11521152
FormatStyle::BLS_AlignFirstComment);
1153+
1154+
const FormatStyle::IntegerLiteralSeparatorStyle
1155+
ExpectedIntegerLiteralSeparatorStyle{/*Binary=*/2,
1156+
/*BinaryMinDigit=*/5,
1157+
/*BinaryMaxDigitNoSeparator=*/2,
1158+
/*Decimal=*/6,
1159+
/*DecimalMinDigit=*/6,
1160+
/*DecimalMaxDigitNoSeparator=*/3,
1161+
/*Hex=*/4,
1162+
/*HexMinDigit=*/2,
1163+
/*HexMaxDigitNoSeparator=*/1};
1164+
CHECK_PARSE("IntegerLiteralSeparator:\n"
1165+
" Binary: 2\n"
1166+
" BinaryMinDigits: 5\n"
1167+
" BinaryMaxDigitsNoSeparator: 2\n"
1168+
" Decimal: 6\n"
1169+
" DecimalMinDigits: 6\n"
1170+
" DecimalMaxDigitsNoSeparator: 3\n"
1171+
" Hex: 4\n"
1172+
" HexMinDigits: 2\n"
1173+
" HexMaxDigitsNoSeparator: 1",
1174+
IntegerLiteralSeparator, ExpectedIntegerLiteralSeparatorStyle);
11531175
}
11541176

11551177
TEST(ConfigParseTest, ParsesConfigurationWithLanguages) {

0 commit comments

Comments
 (0)