[clang] 6a4957c - [clang-format] Add missing test for loops formatting. NFC.

Marek Kurdej via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 14 05:43:43 PST 2022


Author: Marek Kurdej
Date: 2022-01-14T14:43:15+01:00
New Revision: 6a4957cbdff5d60de40639e6c9c8edd056b9a082

URL: https://github.com/llvm/llvm-project/commit/6a4957cbdff5d60de40639e6c9c8edd056b9a082
DIFF: https://github.com/llvm/llvm-project/commit/6a4957cbdff5d60de40639e6c9c8edd056b9a082.diff

LOG: [clang-format] Add missing test for loops formatting. NFC.

The case with an inner while loop wasn't tested before. Same for outer loop with a ForeachMacro.

Added: 
    

Modified: 
    clang/unittests/Format/FormatTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index a2470daeca03..d6e1f7341030 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1473,6 +1473,12 @@ TEST_F(FormatTest, FormatLoopsWithoutCompoundStatement) {
   verifyFormat("for (;;)\n"
                "  for (;;) continue;",
                AllowsMergedLoops);
+  verifyFormat("for (;;)\n"
+               "  while (true) continue;",
+               AllowsMergedLoops);
+  verifyFormat("BOOST_FOREACH (int v, vec)\n"
+               "  for (;;) continue;",
+               AllowsMergedLoops);
   verifyFormat("for (;;) // Can't merge this\n"
                "  continue;",
                AllowsMergedLoops);


        


More information about the cfe-commits mailing list