================
@@ -24,65 +24,72 @@ TEST_F(IntegerLiteralSeparatorTest, SingleQuoteAsSeparator)
{
EXPECT_EQ(Style.IntegerLiteralSeparator.Decimal, 0);
EXPECT_EQ(Style.IntegerLiteralSeparator.Hex, 0);
- constexpr StringRef Binary("b = 0b10011'11'0110'1u;");
- verifyFormat(Binary, Style);
- Style.IntegerLiteralSeparator.Binary = -1;
- verifyFormat("b = 0b100111101101u;", Binary, Style);
- Style.IntegerLiteralSeparator.Binary = 1;
- verifyFormat("b = 0b1'0'0'1'1'1'1'0'1'1'0'1u;", Binary, Style);
- Style.IntegerLiteralSeparator.Binary = 4;
- verifyFormat("b = 0b1001'1110'1101u;", Binary, Style);
-
- constexpr StringRef Decimal("d = 184467'440737'0'95505'92Ull;");
- verifyFormat(Decimal, Style);
- Style.IntegerLiteralSeparator.Decimal = -1;
- verifyFormat("d = 18446744073709550592Ull;", Decimal, Style);
- Style.IntegerLiteralSeparator.Decimal = 3;
- verifyFormat("d = 18'446'744'073'709'550'592Ull;", Decimal, Style);
-
- constexpr StringRef Hex("h = 0xDEAD'BEEF'DE'AD'BEE'Fuz;");
- verifyFormat(Hex, Style);
- Style.IntegerLiteralSeparator.Hex = -1;
- verifyFormat("h = 0xDEADBEEFDEADBEEFuz;", Hex, Style);
- Style.IntegerLiteralSeparator.Hex = 2;
- verifyFormat("h = 0xDE'AD'BE'EF'DE'AD'BE'EFuz;", Hex, Style);
-
- verifyFormat("o0 = 0;\n"
- "o1 = 07;\n"
- "o5 = 012345;",
- Style);
-
- verifyFormat("bi = 0b1'0000i;\n"
- "dif = 1'234if;\n"
- "hil = 0xA'BCil;",
- "bi = 0b10000i;\n"
- "dif = 1234if;\n"
- "hil = 0xABCil;",
- Style);
+ auto TestSingleQuote = [&](auto Language) {
----------------
fauxprogrammer wrote:
I agree with you. I wrote it this way for consistency with the other unit
tests in this test file. The test TEST_F(IntegerLiteralSeparatorTest,
UnderscoreAsSeparator) was built the same way with the redundant validation:
TestUnderscore(FormatStyle::LK_CSharp);
TestUnderscore(FormatStyle::LK_Java);
TestUnderscore(FormatStyle::LK_JavaScript);
Again I defer to you on if you want to keep the consistency in testing method
or have a single test.
https://github.com/llvm/llvm-project/pull/182296
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits