aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-01-10 20:12:55 +0000
committerNico Weber <nicolasweber@gmx.de>2013-01-10 20:12:55 +0000
commit5f500df1b28e6b1c49d4256dda130ecd8696ea2e (patch)
tree8cbbe4aa95069fc949286f67bae3d0b5a11eadf0 /unittests/Format/FormatTest.cpp
parentf9ea2ed30a8dec954f3d78ca43afc0be914bb1db (diff)
Formatting: In @implementation etc lines, put a space before protocol lists.
Don't do this in Google style though: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols Most other places (function declarations, variable declarations) still get this wrong, and since this looks very similiar to template instantiations to the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index b55cad742e..9d29880722 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1186,7 +1186,7 @@ TEST_F(FormatTest, FormatObjCBlocks) {
TEST_F(FormatTest, FormatObjCInterface) {
// FIXME: Handle comments like in "@interface /* wait for it */ Foo", PR14875
// FIXME: In google style, it's "+(id) init", not "+ (id)init".
- verifyFormat("@interface Foo : NSObject<NSSomeDelegate> {\n"
+ verifyFormat("@interface Foo : NSObject <NSSomeDelegate> {\n"
"@public\n"
" int field1;\n"
"@protected\n"
@@ -1199,7 +1199,6 @@ TEST_F(FormatTest, FormatObjCInterface) {
"+ (id)init;\n"
"@end");
- // FIXME: In LLVM style, there should be a space before '<' for protocols.
verifyGoogleFormat("@interface Foo : NSObject<NSSomeDelegate> {\n"
" @public\n"
" int field1;\n"
@@ -1228,10 +1227,14 @@ TEST_F(FormatTest, FormatObjCInterface) {
"+ (id)init;\n"
"@end");
- verifyFormat("@interface Foo : Bar<Baz, Quux>\n"
+ verifyFormat("@interface Foo : Bar <Baz, Quux>\n"
"+ (id)init;\n"
"@end");
+ verifyGoogleFormat("@interface Foo : Bar<Baz, Quux>\n"
+ "+ (id)init;\n"
+ "@end");
+
verifyFormat("@interface Foo (HackStuff)\n"
"+ (id)init;\n"
"@end");
@@ -1240,10 +1243,14 @@ TEST_F(FormatTest, FormatObjCInterface) {
"+ (id)init;\n"
"@end");
- verifyFormat("@interface Foo (HackStuff)<MyProtocol>\n"
+ verifyFormat("@interface Foo (HackStuff) <MyProtocol>\n"
"+ (id)init;\n"
"@end");
+ verifyGoogleFormat("@interface Foo (HackStuff)<MyProtocol>\n"
+ "+ (id)init;\n"
+ "@end");
+
verifyFormat("@interface Foo {\n"
" int _i;\n"
"}\n"
@@ -1256,7 +1263,7 @@ TEST_F(FormatTest, FormatObjCInterface) {
"+ (id)init;\n"
"@end");
- verifyFormat("@interface Foo : Bar<Baz, Quux> {\n"
+ verifyFormat("@interface Foo : Bar <Baz, Quux> {\n"
" int _i;\n"
"}\n"
"+ (id)init;\n"
@@ -1274,7 +1281,7 @@ TEST_F(FormatTest, FormatObjCInterface) {
"+ (id)init;\n"
"@end");
- verifyFormat("@interface Foo (HackStuff)<MyProtocol> {\n"
+ verifyFormat("@interface Foo (HackStuff) <MyProtocol> {\n"
" int _i;\n"
"}\n"
"+ (id)init;\n"
@@ -1351,11 +1358,14 @@ TEST_F(FormatTest, FormatObjCProtocol) {
"- (NSUInteger)numberOfThings;\n"
"@end");
- // FIXME: In LLVM style, there should be a space before '<' for protocols.
- verifyFormat("@protocol MyProtocol<NSObject>\n"
+ verifyFormat("@protocol MyProtocol <NSObject>\n"
"- (NSUInteger)numberOfThings;\n"
"@end");
+ verifyGoogleFormat("@protocol MyProtocol<NSObject>\n"
+ "- (NSUInteger)numberOfThings;\n"
+ "@end");
+
verifyFormat("@protocol Foo;\n"
"@protocol Bar;\n");