diff options
Diffstat (limited to 'clang/unittests/Format/FormatTestObjC.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestObjC.cpp | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTestObjC.cpp b/clang/unittests/Format/FormatTestObjC.cpp index c29c9d702bc..c29bf8545ab 100644 --- a/clang/unittests/Format/FormatTestObjC.cpp +++ b/clang/unittests/Format/FormatTestObjC.cpp @@ -328,7 +328,14 @@ TEST_F(FormatTestObjC, FormatObjCInterface) { "}\n" "+ (id)init;\n" "@end"); - + verifyFormat("@interface Foo\n" + "- (void)foo {\n" + "}\n" + "@end\n" + "@implementation Bar\n" + "- (void)bar {\n" + "}\n" + "@end"); Style.ColumnLimit = 40; verifyFormat("@interface ccccccccccccc () <\n" " ccccccccccccc, ccccccccccccc,\n" @@ -969,6 +976,59 @@ TEST_F(FormatTestObjC, ObjCCxxKeywords) { verifyFormat("MACRO(new:)\n"); verifyFormat("MACRO(delete:)\n"); verifyFormat("foo = @{MACRO(new:) : MACRO(delete:)}\n"); + verifyFormat("@implementation Foo\n" + "// Testing\n" + "- (Class)class {\n" + "}\n" + "- (void)foo {\n" + "}\n" + "@end\n"); + verifyFormat("@implementation Foo\n" + "- (Class)class {\n" + "}\n" + "- (void)foo {\n" + "}\n" + "@end"); + verifyFormat("@implementation Foo\n" + "+ (Class)class {\n" + "}\n" + "- (void)foo {\n" + "}\n" + "@end"); + verifyFormat("@implementation Foo\n" + "- (Class)class:(Class)klass {\n" + "}\n" + "- (void)foo {\n" + "}\n" + "@end"); + verifyFormat("@implementation Foo\n" + "+ (Class)class:(Class)klass {\n" + "}\n" + "- (void)foo {\n" + "}\n" + "@end"); + + verifyFormat("@interface Foo\n" + "// Testing\n" + "- (Class)class;\n" + "- (void)foo;\n" + "@end\n"); + verifyFormat("@interface Foo\n" + "- (Class)class;\n" + "- (void)foo;\n" + "@end"); + verifyFormat("@interface Foo\n" + "+ (Class)class;\n" + "- (void)foo;\n" + "@end"); + verifyFormat("@interface Foo\n" + "- (Class)class:(Class)klass;\n" + "- (void)foo;\n" + "@end"); + verifyFormat("@interface Foo\n" + "+ (Class)class:(Class)klass;\n" + "- (void)foo;\n" + "@end"); } TEST_F(FormatTestObjC, ObjCLiterals) { |