Author: owenca Date: 2022-05-05T15:12:24-07:00 New Revision: e7aed737eb2d8fb2150f38e48d1c3e0108931999
URL: https://github.com/llvm/llvm-project/commit/e7aed737eb2d8fb2150f38e48d1c3e0108931999 DIFF: https://github.com/llvm/llvm-project/commit/e7aed737eb2d8fb2150f38e48d1c3e0108931999.diff LOG: [clang-format][NFC] Add a few regression tests Added: Modified: clang/unittests/Format/FormatTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 40e2cb054b242..d7d69f950a323 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1573,6 +1573,17 @@ TEST_F(FormatTest, FormatShortBracedStatements) { " f();\n" "}"); + AllowSimpleBracedStatements.AllowShortBlocksOnASingleLine = + FormatStyle::SBS_Empty; + AllowSimpleBracedStatements.AllowShortIfStatementsOnASingleLine = + FormatStyle::SIS_WithoutElse; + verifyFormat("if (true) {}", AllowSimpleBracedStatements); + verifyFormat("if (i) break;", AllowSimpleBracedStatements); + verifyFormat("if (i > 0) {\n" + " return i;\n" + "}", + AllowSimpleBracedStatements); + AllowSimpleBracedStatements.IfMacros.push_back("MYIF"); // Where line-lengths matter, a 2-letter synonym that maintains line length. // Not IF to avoid any confusion that IF is somehow special. @@ -1580,11 +1591,7 @@ TEST_F(FormatTest, FormatShortBracedStatements) { AllowSimpleBracedStatements.ColumnLimit = 40; AllowSimpleBracedStatements.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Always; - - AllowSimpleBracedStatements.AllowShortIfStatementsOnASingleLine = - FormatStyle::SIS_WithoutElse; AllowSimpleBracedStatements.AllowShortLoopsOnASingleLine = true; - AllowSimpleBracedStatements.BreakBeforeBraces = FormatStyle::BS_Custom; AllowSimpleBracedStatements.BraceWrapping.AfterFunction = true; AllowSimpleBracedStatements.BraceWrapping.SplitEmptyRecord = false; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits