[PATCH] D70528: [NFC] ASSERT_EQ before accessing items in containers
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 04:51:48 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc547c22f1897: [NFC] ASSERT_EQ before accessing items in containers (authored by kbobyrev).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70528/new/
https://reviews.llvm.org/D70528
Files:
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -709,7 +709,10 @@
auto Parsed = TU.build();
for (const auto &D : Parsed.getDiagnostics()) {
- EXPECT_EQ(D.Fixes.size(), 1u);
+ if (D.Fixes.size() != 1) {
+ ADD_FAILURE() << "D.Fixes.size() != 1";
+ continue;
+ }
EXPECT_EQ(D.Fixes[0].Message,
std::string("Add include \"a.h\" for symbol X"));
}
Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -1874,7 +1874,10 @@
Annotations TestCode(Text);
auto Results = completions(Server, TestCode.code(), TestCode.point());
- EXPECT_EQ(Results.Completions.size(), 1u);
+ if (Results.Completions.size() != 1) {
+ ADD_FAILURE() << "Results.Completions.size() != 1";
+ continue;
+ }
EXPECT_THAT(Results.Completions.front().CompletionTokenRange,
TestCode.range());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70528.231048.patch
Type: text/x-patch
Size: 1269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191126/7111c205/attachment.bin>
More information about the cfe-commits
mailing list