Changeset View
Changeset View
Standalone View
Standalone View
clang-tools-extra/trunk/clangd/unittests/DiagnosticsTests.cpp
Show First 20 Lines • Show All 942 Lines • ▼ Show 20 Lines | Annotations Header(R"cpp( | ||||
int x = 5/0; | int x = 5/0; | ||||
int b = [[FOO]];)cpp"); | int b = [[FOO]];)cpp"); | ||||
TestTU TU = TestTU::withCode(Main.code()); | TestTU TU = TestTU::withCode(Main.code()); | ||||
TU.AdditionalFiles = {{"a.h", Header.code()}}; | TU.AdditionalFiles = {{"a.h", Header.code()}}; | ||||
TU.ExtraArgs = {"-DFOO=NOOO"}; | TU.ExtraArgs = {"-DFOO=NOOO"}; | ||||
EXPECT_THAT(TU.build().getDiagnostics(), UnorderedElementsAre()); | EXPECT_THAT(TU.build().getDiagnostics(), UnorderedElementsAre()); | ||||
} | } | ||||
TEST(IgnoreDiags, FromNonWrittenInclude) { | |||||
TestTU TU = TestTU::withCode(""); | |||||
TU.ExtraArgs.push_back("--include=a.h"); | |||||
TU.AdditionalFiles = {{"a.h", "void main();"}}; | |||||
// The diagnostic "main must return int" is from the header, we don't attempt | |||||
// to render it in the main file as there is no written location there. | |||||
EXPECT_THAT(TU.build().getDiagnostics(), UnorderedElementsAre()); | |||||
} | |||||
} // namespace | } // namespace | ||||
} // namespace clangd | } // namespace clangd | ||||
} // namespace clang | } // namespace clang |