Fix crash on invalid.
if { foo; }
would previously crash clang-format.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172232 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 71fa83c..6beee31 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1108,6 +1108,10 @@
"}");
}
+TEST_F(FormatTest, IncorrectIf) {
+ verifyFormat("if {\n foo;\n foo();\n}");
+}
+
TEST_F(FormatTest, DoesNotTouchUnwrappedLinesWithErrors) {
verifyFormat("namespace {\n"
"class Foo { Foo ( }; } // comment");