[clang-tools-extra] 4b76ba8 - [clangd] Eliminate direct usage of isAvailable() matcher. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri May 6 07:35:31 PDT 2022
Author: Sam McCall
Date: 2022-05-06T16:35:12+02:00
New Revision: 4b76ba887c04458367c37eb3458cbd113475c27f
URL: https://github.com/llvm/llvm-project/commit/4b76ba887c04458367c37eb3458cbd113475c27f
DIFF: https://github.com/llvm/llvm-project/commit/4b76ba887c04458367c37eb3458cbd113475c27f.diff
LOG: [clangd] Eliminate direct usage of isAvailable() matcher. NFC
This prepares to replace the implementation of EXPECT_[UN]AVAILABLE with
something more efficient.
Added:
Modified:
clang-tools-extra/clangd/unittests/tweaks/DumpRecordLayoutTests.cpp
clang-tools-extra/clangd/unittests/tweaks/SwapIfBranchesTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/tweaks/DumpRecordLayoutTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/DumpRecordLayoutTests.cpp
index 7f7f629e4324..fb0eda266dd7 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/DumpRecordLayoutTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/DumpRecordLayoutTests.cpp
@@ -22,10 +22,10 @@ TWEAK_TEST(DumpRecordLayout);
TEST_F(DumpRecordLayoutTest, Test) {
EXPECT_AVAILABLE("^s^truct ^X ^{ int x; ^};");
- EXPECT_THAT("struct X { int ^a; };", Not(isAvailable()));
- EXPECT_THAT("struct ^X;", Not(isAvailable()));
- EXPECT_THAT("template <typename T> struct ^X { T t; };", Not(isAvailable()));
- EXPECT_THAT("enum ^X {};", Not(isAvailable()));
+ EXPECT_UNAVAILABLE("struct X { int ^a; };");
+ EXPECT_UNAVAILABLE("struct ^X;");
+ EXPECT_UNAVAILABLE("template <typename T> struct ^X { T t; };");
+ EXPECT_UNAVAILABLE("enum ^X {};");
EXPECT_THAT(apply("struct ^X { int x; int y; };"),
AllOf(StartsWith("message:"), HasSubstr("0 | int x")));
diff --git a/clang-tools-extra/clangd/unittests/tweaks/SwapIfBranchesTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/SwapIfBranchesTests.cpp
index b22da9dcd98b..0bfada85792a 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/SwapIfBranchesTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/SwapIfBranchesTests.cpp
@@ -27,19 +27,17 @@ TEST_F(SwapIfBranchesTest, Test) {
EXPECT_AVAILABLE("^i^f^^(^t^r^u^e^) { return; } ^e^l^s^e^ { return; }");
EXPECT_UNAVAILABLE("if (true) {^return ^;^ } else { ^return^;^ }");
// Available in subexpressions of the condition;
- EXPECT_THAT("if(2 + [[2]] + 2) { return; } else {return;}", isAvailable());
+ EXPECT_AVAILABLE("if(2 + [[2]] + 2) { return; } else {return;}");
// But not as part of the branches.
- EXPECT_THAT("if(2 + 2 + 2) { [[return]]; } else { return; }",
- Not(isAvailable()));
+ EXPECT_UNAVAILABLE("if(2 + 2 + 2) { [[return]]; } else { return; }");
// Range covers the "else" token, so available.
- EXPECT_THAT("if(2 + 2 + 2) { return[[; } else {return;]]}", isAvailable());
+ EXPECT_AVAILABLE("if(2 + 2 + 2) { return[[; } else {return;]]}");
// Not available in compound statements in condition.
- EXPECT_THAT("if([]{return [[true]];}()) { return; } else { return; }",
- Not(isAvailable()));
+ EXPECT_UNAVAILABLE("if([]{return [[true]];}()) { return; } else { return; }");
// Not available if both sides aren't braced.
- EXPECT_THAT("^if (1) return; else { return; }", Not(isAvailable()));
+ EXPECT_UNAVAILABLE("^if (1) return; else { return; }");
// Only one if statement is supported!
- EXPECT_THAT("[[if(1){}else{}if(2){}else{}]]", Not(isAvailable()));
+ EXPECT_UNAVAILABLE("[[if(1){}else{}if(2){}else{}]]");
}
} // namespace
More information about the cfe-commits
mailing list