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
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 2f66e54..eb87a3b 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -29,7 +29,8 @@
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 @@
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 @@
"}\n", format("{\n"
" {\n"
" breakme(qwe);\n"
- "}\n", Style));
-
+ "}\n", getLLVMStyleWithColumns(10)));
}
TEST_F(FormatTest, LayoutCallsInsideBraceInitializers) {