[clang] 6982f1f - [clang-format][NFC] Test formatting the input before messing it up

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 00:59:43 PDT 2023


Author: Owen Pan
Date: 2023-08-29T00:59:33-07:00
New Revision: 6982f1fc2e750cfbb4b0098a6294d341238656ca

URL: https://github.com/llvm/llvm-project/commit/6982f1fc2e750cfbb4b0098a6294d341238656ca
DIFF: https://github.com/llvm/llvm-project/commit/6982f1fc2e750cfbb4b0098a6294d341238656ca.diff

LOG: [clang-format][NFC] Test formatting the input before messing it up

Differential Revision: https://reviews.llvm.org/D158947

Added: 
    

Modified: 
    clang/unittests/Format/FormatTestBase.h

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Format/FormatTestBase.h b/clang/unittests/Format/FormatTestBase.h
index 2b0c4550bb951f..22eea23b869a21 100644
--- a/clang/unittests/Format/FormatTestBase.h
+++ b/clang/unittests/Format/FormatTestBase.h
@@ -105,7 +105,9 @@ class FormatTestBase : public ::testing::Test {
 
   void _verifyFormat(const char *File, int Line, llvm::StringRef Code,
                      const std::optional<FormatStyle> &Style = {}) {
-    _verifyFormat(File, Line, Code, test::messUp(Code), Style);
+    _verifyFormat(File, Line, Code, Code, Style);
+    if (const auto MessedUpCode{messUp(Code)}; MessedUpCode != Code)
+      _verifyFormat(File, Line, Code, MessedUpCode, Style);
   }
 
   void _verifyIncompleteFormat(const char *File, int Line, llvm::StringRef Code,


        


More information about the cfe-commits mailing list