aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
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"
// "};");