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

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 26 20:10:29 PDT 2023


owenpan created this revision.
Herald added projects: All, clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, MyDeveloperDay.
owenpan requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158947

Files:
  clang/unittests/Format/FormatTestBase.h


Index: clang/unittests/Format/FormatTestBase.h
===================================================================
--- clang/unittests/Format/FormatTestBase.h
+++ clang/unittests/Format/FormatTestBase.h
@@ -105,7 +105,9 @@
 
   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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158947.553774.patch
Type: text/x-patch
Size: 703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230827/18747488/attachment.bin>


More information about the cfe-commits mailing list