aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2012-12-04 13:02:32 +0000
committerDaniel Jasper <djasper@google.com>2012-12-04 13:02:32 +0000
commit8822d3a99c07c7d874f8bfd81a7fe02059b9c19e (patch)
tree0939c4db617a985804dc8ce5768331a28badd79c /unittests/Format/FormatTest.cpp
parent00a3cccb8cbd9accddfa0e77e85939e263d6a10d (diff)
Small fixes to unary operator recognition and handling of include
directives. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index ca8df571ff..f64ea4acd6 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -315,6 +315,9 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) {
TEST_F(FormatTest, UndestandsUnaryOperators) {
verifyFormat("int a = -2;");
+ verifyFormat("f(-1, -2, -3);");
+ verifyFormat("a[-1] = 5;");
+ verifyFormat("int a = 5 + -2;");
}
TEST_F(FormatTest, UndestandsOverloadedOperators) {
@@ -333,6 +336,13 @@ TEST_F(FormatTest, UnderstandsUsesOfStar) {
// verifyFormat("int a = b * *c;");
}
+TEST_F(FormatTest, HandlesIncludeDirectives) {
+ EXPECT_EQ("#include <string>\n", format("#include <string>\n"));
+ EXPECT_EQ("#include \"a/b/string\"\n", format("#include \"a/b/string\"\n"));
+ EXPECT_EQ("#include \"string.h\"\n", format("#include \"string.h\"\n"));
+ EXPECT_EQ("#include \"string.h\"\n", format("#include \"string.h\"\n"));
+}
+
//TEST_F(FormatTest, IncorrectDerivedClass) {
// verifyFormat("public B {\n"
// "};");