summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index ca8df571ffe..f64ea4acd67 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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"
// "};");
OpenPOWER on IntegriCloud