aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-11 18:28:36 +0000
committerManuel Klimek <klimek@google.com>2013-01-11 18:28:36 +0000
commitd465843f5376c7c1574fe61338cbf3dc50684d5b (patch)
tree7e99bcab91e4b71fdf75d698c9f17740b91a7866 /unittests/Format/FormatTest.cpp
parent606e07ecc0b7b0e01d23baa833b4b4c73af0d4f4 (diff)
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
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 71fa83ccb1..6beee3186b 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1108,6 +1108,10 @@ TEST_F(FormatTest, IncorrectCodeDoNoWhile) {
"}");
}
+TEST_F(FormatTest, IncorrectIf) {
+ verifyFormat("if {\n foo;\n foo();\n}");
+}
+
TEST_F(FormatTest, DoesNotTouchUnwrappedLinesWithErrors) {
verifyFormat("namespace {\n"
"class Foo { Foo ( }; } // comment");