[PATCH] D42649: [clang-format] Add more tests for ObjC protocol list formatting behavior

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 09:48:51 PST 2018


benhamilton created this revision.
benhamilton added reviewers: krasimir, jolesiak.
Herald added subscribers: cfe-commits, klimek.

The existing unit tests in FormatTestObjC.cpp didn't fully cover
all the cases for protocol confirmance list formatting.

This extends the unit tests to more cases of protocol
conformance list formatting, especially how the behavior changes
when `BinPackParameters` changes from `true` (the default) to `false`.

Test Plan: make -j12 FormatTests && \

  ./tools/clang/unittests/Format/FormatTests --gtest_filter=FormatTestObjC.\*


Repository:
  rC Clang

https://reviews.llvm.org/D42649

Files:
  unittests/Format/FormatTestObjC.cpp


Index: unittests/Format/FormatTestObjC.cpp
===================================================================
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -276,6 +276,20 @@
                "+ (id)init;\n"
                "@end");
 
+  Style.ColumnLimit = 40;
+  verifyFormat("@interface ccccccccccccc () <\n"
+               "    ccccccccccccc, ccccccccccccc,\n"
+               "    ccccccccccccc, ccccccccccccc> {\n"
+               "}");
+
+  Style.BinPackParameters = false;
+  verifyFormat("@interface ddddddddddddd () <\n"
+               "    ddddddddddddd,\n"
+               "    ddddddddddddd,\n"
+               "    ddddddddddddd,\n"
+               "    ddddddddddddd> {\n"
+               "}");
+
   Style = getGoogleStyle(FormatStyle::LK_ObjC);
   verifyFormat("@interface Foo : NSObject <NSSomeDelegate> {\n"
                " @public\n"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42649.131821.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180129/38d050b1/attachment.bin>


More information about the cfe-commits mailing list