diff options
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 2ba4765cc7..d3144432d4 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -30,6 +30,7 @@ protected: LangOpts.CPlusPlus = 1; LangOpts.CPlusPlus11 = 1; LangOpts.ObjC1 = 1; + LangOpts.ObjC2 = 1; Lexer Lex(ID, Context.Sources.getBuffer(ID), Context.Sources, LangOpts); tooling::Replacements Replace = reformat(Style, Lex, Context.Sources, Ranges); @@ -424,6 +425,34 @@ TEST_F(FormatTest, FormatObjCTryCatch) { "}"); } +TEST_F(FormatTest, FormatObjCInterface) { + verifyFormat("@interface Foo : NSObject<NSSomeDelegate> {\n" + "@public\n" + " int field1;\n" + "@protected\n" + " int field2;\n" + "@private\n" + " int field3;\n" + "@package\n" + " int field4;\n" + "}\n" + "+ (id)init;\n" + "@end"); + + verifyGoogleFormat("@interface Foo : NSObject<NSSomeDelegate> {\n" + " @public\n" + " int field1;\n" + " @protected\n" + " int field2;\n" + " @private\n" + " int field3;\n" + " @package\n" + " int field4;\n" + "}\n" + "+ (id)init;\n" + "@end"); +} + TEST_F(FormatTest, StaticInitializers) { verifyFormat("static SomeClass SC = { 1, 'a' };"); |