aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-01-14 11:34:14 +0000
committerAlexander Kornienko <alexfh@google.com>2013-01-14 11:34:14 +0000
commita4ae9f30ef7bccdaa3feef8036af07fbb91f107c (patch)
tree8ad6c13025dcfb2778c32dfb3ff9772b99e4de2d /unittests/Format
parent1b6f4bd8d7e75e775053b1cb1281c6a127746e93 (diff)
Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.
Summary: Added tests for clang-format diagnostics. Added DiagnosticConsumer argument to clang::format::reformat(). Reviewers: klimek, djasper Reviewed By: djasper CC: cfe-commits, thakis, rafael.espindola Differential Revision: http://llvm-reviews.chandlerc.com/D290 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format')
-rw-r--r--unittests/Format/FormatTest.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 2f66e5454c..eb87a3b965 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -29,7 +29,8 @@ protected:
Lexer Lex(ID, Context.Sources.getBuffer(ID), Context.Sources,
getFormattingLangOpts());
tooling::Replacements Replace = reformat(Style, Lex, Context.Sources,
- Ranges);
+ Ranges,
+ new IgnoringDiagConsumer());
EXPECT_TRUE(applyAllReplacements(Replace, Context.Rewrite));
return Context.getRewrittenText(ID);
}
@@ -1206,8 +1207,6 @@ TEST_F(FormatTest, IncorrectCodeErrorDetection) {
EXPECT_EQ("{\n {}\n", format("{\n {\n }\n"));
EXPECT_EQ("{\n {}\n }\n}\n", format("{\n {\n }\n }\n}\n"));
- FormatStyle Style = getLLVMStyle();
- Style.ColumnLimit = 10;
EXPECT_EQ("{\n"
" {\n"
" breakme(\n"
@@ -1215,8 +1214,7 @@ TEST_F(FormatTest, IncorrectCodeErrorDetection) {
"}\n", format("{\n"
" {\n"
" breakme(qwe);\n"
- "}\n", Style));
-
+ "}\n", getLLVMStyleWithColumns(10)));
}
TEST_F(FormatTest, LayoutCallsInsideBraceInitializers) {