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.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 5c1b6031c6..745ecec730 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -381,5 +381,23 @@ TEST_F(FormatTest, IncorrectCodeDoNoWhile) {
"};");
}
+TEST_F(FormatTest, IncorrectCodeErrorDetection) {
+ EXPECT_EQ("{\n{\n}\n", format("{\n{\n}\n"));
+ EXPECT_EQ("{\n {\n}\n", format("{\n {\n}\n"));
+ EXPECT_EQ("{\n {\n }\n", format("{\n {\n }\n"));
+
+ FormatStyle Style = getLLVMStyle();
+ Style.ColumnLimit = 10;
+ EXPECT_EQ("{\n"
+ " {\n"
+ " breakme(\n"
+ " qwe);\n"
+ "}\n", format("{\n"
+ " {\n"
+ " breakme(qwe);\n"
+ "}\n", Style));
+
+}
+
} // end namespace tooling
} // end namespace clang