]> granicus.if.org Git - clang/commitdiff
[clang-format] Add more tests for ObjC protocol list formatting behavior
authorBen Hamilton <benhamilton@google.com>
Mon, 29 Jan 2018 20:01:49 +0000 (20:01 +0000)
committerBen Hamilton <benhamilton@google.com>
Mon, 29 Jan 2018 20:01:49 +0000 (20:01 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323684 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Format/FormatTestObjC.cpp

index 879932db0dbc236abbc0104c7187866f85bf543a..23e90663717b6d781e5599ad712aaebeb5624e3a 100644 (file)
@@ -276,6 +276,20 @@ TEST_F(FormatTestObjC, FormatObjCInterface) {
                "+ (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"