summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
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
commit116ba682202e0e3156d2c76aef7ce6c1030f4b68 (patch)
treebefae17a34d43a38e460465493e24bc32b39d7bb /clang/unittests/Format/FormatTest.cpp
parent66b35642d4783f9824f38b5fcdc01342c438fc55 (diff)
downloadbcm5719-llvm-116ba682202e0e3156d2c76aef7ce6c1030f4b68.tar.gz
bcm5719-llvm-116ba682202e0e3156d2c76aef7ce6c1030f4b68.zip
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 llvm-svn: 172399
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 2f66e5454cb..eb87a3b9657 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud