================ @@ -0,0 +1,354 @@ +//===- unittest/Format/NumericLiteralCaseTest.cpp -------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "FormatTestBase.h" + +#define DEBUG_TYPE "numeric-literal-case-test" + +namespace clang { +namespace format { +namespace test { +namespace { + +class NumericLiteralCaseTest : public FormatTestBase {}; + +TEST_F(NumericLiteralCaseTest, Prefix) { + FormatStyle Style = getLLVMStyle(); + EXPECT_EQ(Style.Language, FormatStyle::LK_Cpp); + EXPECT_EQ(Style.NumericLiteralCase.Prefix, FormatStyle::NLCS_Leave); + EXPECT_EQ(Style.NumericLiteralCase.HexDigit, FormatStyle::NLCS_Leave); + EXPECT_EQ(Style.NumericLiteralCase.ExponentLetter, FormatStyle::NLCS_Leave); + EXPECT_EQ(Style.NumericLiteralCase.Suffix, FormatStyle::NLCS_Leave); + + constexpr StringRef Bin0{"b = 0b0'10'010uL;"}; + constexpr StringRef Bin1{"b = 0B010'010Ul;"}; + constexpr StringRef Hex0{"b = 0xdead'BEEFuL;"}; + constexpr StringRef Hex1{"b = 0Xdead'BEEFUl;"}; + verifyFormat(Bin0, Style); + verifyFormat(Bin1, Style); + verifyFormat(Hex0, Style); + verifyFormat(Hex1, Style); ---------------- owenca wrote:
```suggestion verifyFormat(Bin0); verifyFormat(Bin1); verifyFormat(Hex0); verifyFormat(Hex1); ``` Also, you can move lines 28-36 to the top. https://github.com/llvm/llvm-project/pull/151590 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits