diff options
author | Alexander Kornienko <alexfh@google.com> | 2012-12-04 17:27:50 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2012-12-04 17:27:50 +0000 |
commit | cff563c0123bbb8d959c93ed371d27cbc6bc4a29 (patch) | |
tree | 9aacc432b98df1f22275726c196a421a78fa4216 /unittests/Format/FormatTest.cpp | |
parent | ff685c562c8fd5dfc6effec17377fde9dad6f271 (diff) |
Error recovery part 2
Summary: Adds recovery for structural errors in clang-format.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, silvas
Differential Revision: http://llvm-reviews.chandlerc.com/D164
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 18 |
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 |