r323684 - [clang-format] Add more tests for ObjC protocol list formatting behavior

Ben Hamilton via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 12:01:50 PST 2018


Author: benhamilton
Date: Mon Jan 29 12:01:49 2018
New Revision: 323684

URL: http://llvm.org/viewvc/llvm-project?rev=323684&view=rev
Log:
[clang-format] Add more tests for ObjC protocol list formatting behavior

Summary:
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.\*

Reviewers: krasimir, jolesiak, stephanemoore

Reviewed By: krasimir

Subscribers: benhamilton, klimek, cfe-commits, hokein, Wizard

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

Modified:
    cfe/trunk/unittests/Format/FormatTestObjC.cpp

Modified: cfe/trunk/unittests/Format/FormatTestObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestObjC.cpp?rev=323684&r1=323683&r2=323684&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestObjC.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestObjC.cpp Mon Jan 29 12:01:49 2018
@@ -276,6 +276,20 @@ TEST_F(FormatTestObjC, FormatObjCInterfa
                "+ (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"




More information about the cfe-commits mailing list