diff options
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r-- | clang/unittests/Format/ConfigParseTest.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 2513ab39..aded3ed 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -15,6 +15,7 @@ namespace clang { namespace format { namespace { +void dropDiagnosticHandler(const llvm::SMDiagnostic &, void *) {} FormatStyle getGoogleStyle() { return getGoogleStyle(FormatStyle::LK_Cpp); } #define EXPECT_ALL_STYLES_EQUAL(Styles) \ @@ -1240,7 +1241,8 @@ TEST(ConfigParseTest, GetStyleOfFile) { llvm::consumeError(Style4.takeError()); // Test 5: error on invalid yaml on command line - auto Style5 = getStyle("{invalid_key=invalid_value}", "a.h", "LLVM", "", &FS); + auto Style5 = getStyle("{invalid_key=invalid_value}", "a.h", "LLVM", "", &FS, + /*AllowUnknownOptions=*/false, dropDiagnosticHandler); ASSERT_FALSE((bool)Style5); llvm::consumeError(Style5.takeError()); @@ -1256,11 +1258,13 @@ TEST(ConfigParseTest, GetStyleOfFile) { "InvalidKey: InvalidValue"))); ASSERT_TRUE( FS.addFile("/d/test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int i;"))); - auto Style7a = getStyle("file", "/d/.clang-format", "LLVM", "", &FS); + auto Style7a = getStyle("file", "/d/.clang-format", "LLVM", "", &FS, + /*AllowUnknownOptions=*/false, dropDiagnosticHandler); ASSERT_FALSE((bool)Style7a); llvm::consumeError(Style7a.takeError()); - auto Style7b = getStyle("file", "/d/.clang-format", "LLVM", "", &FS, true); + auto Style7b = getStyle("file", "/d/.clang-format", "LLVM", "", &FS, + /*AllowUnknownOptions=*/true, dropDiagnosticHandler); ASSERT_TRUE((bool)Style7b); // Test 8: inferred per-language defaults apply. @@ -1466,8 +1470,7 @@ TEST(ConfigParseTest, GetStyleOutput) { // Suppress stderr. testing::internal::CaptureStderr(); Style = getStyle("{invalid_key=invalid_value}", "a.h", "LLVM", "", &FS, - /*AllowUnknownOptions=*/true, - [](const llvm::SMDiagnostic &, void *) {}); + /*AllowUnknownOptions=*/true, dropDiagnosticHandler); Output = testing::internal::GetCapturedStderr(); ASSERT_TRUE((bool)Style); ASSERT_TRUE(Output.empty()); |