Clang-format: error recovery for access specifiers
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D198
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169738 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index d00da7f..79cefc4 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -498,10 +498,26 @@
// Error recovery tests.
//===----------------------------------------------------------------------===//
-//TEST_F(FormatTest, IncorrectDerivedClass) {
-// verifyFormat("public B {\n"
-// "};");
-//}
+TEST_F(FormatTest, IncorrectAccessSpecifier) {
+ verifyFormat("public:");
+ verifyFormat("class A {\n"
+ "public\n"
+ " void f() {\n"
+ " }\n"
+ "};");
+ verifyFormat("public\n"
+ "int qwerty;");
+ verifyFormat("public\n"
+ "B {\n"
+ "};");
+ verifyFormat("public\n"
+ "{\n"
+ "};");
+ verifyFormat("public\n"
+ "B {\n"
+ " int x;\n"
+ "};");
+}
TEST_F(FormatTest, IncorrectCodeUnbalancedBraces) {
verifyFormat("{");