r174559 - Formatter: Move ObjC literal tests to its own test case.

Nico Weber nicolasweber at gmx.de
Wed Feb 6 16:19:29 PST 2013


Author: nico
Date: Wed Feb  6 18:19:29 2013
New Revision: 174559

URL: http://llvm.org/viewvc/llvm-project?rev=174559&view=rev
Log:
Formatter: Move ObjC literal tests to its own test case.

Slightly expand the boxed expressions test with a few more snippets from
http://clang.llvm.org/docs/ObjectiveCLiterals.html


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

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=174559&r1=174558&r2=174559&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Feb  6 18:19:29 2013
@@ -2478,19 +2478,6 @@ TEST_F(FormatTest, ObjCAt) {
   verifyFormat("@throw");
   verifyFormat("@try");
 
-  verifyFormat("@\"String\"");
-  verifyFormat("@1");
-  verifyFormat("@+4.8");
-  verifyFormat("@-4");
-  verifyFormat("@1LL");
-  verifyFormat("@.5");
-  verifyFormat("@'c'");
-  verifyFormat("@true");
-  verifyFormat("NSNumber *smallestInt = @(-INT_MAX - 1);");
-  // FIXME: Array and dictionary literals need more work.
-  verifyFormat("@[");
-  verifyFormat("@{");
-
   EXPECT_EQ("@interface", format("@ interface"));
 
   // The precise formatting of this doesn't matter, nobody writes code like
@@ -2523,5 +2510,26 @@ TEST_F(FormatTest, ObjCSnippets) {
   verifyGoogleFormat("@property(assign, getter=isEditable) BOOL editable;");
 }
 
+TEST_F(FormatTest, ObjCLiterals) {
+  verifyFormat("@\"String\"");
+  verifyFormat("@1");
+  verifyFormat("@+4.8");
+  verifyFormat("@-4");
+  verifyFormat("@1LL");
+  verifyFormat("@.5");
+  verifyFormat("@'c'");
+  verifyFormat("@true");
+
+  verifyFormat("NSNumber *smallestInt = @(-INT_MAX - 1);");
+  verifyFormat("NSNumber *piOverTwo = @(M_PI / 2);");
+  verifyFormat("NSNumber *favoriteColor = @(Green);");
+  verifyFormat("NSString *path = @(getenv(\"PATH\"));");
+
+  // FIXME: Array and dictionary literals need more work.
+  verifyFormat("@[");
+  verifyFormat("@{");
+
+}
+
 } // end namespace tooling
 } // end namespace clang





More information about the cfe-commits mailing list