[clang-tools-extra] c2d7a1f - [clangd] Add test for FindTarget+RecoveryExpr (which already works). NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 25 16:41:06 PDT 2020
Author: Sam McCall
Date: 2020-03-26T00:40:29+01:00
New Revision: c2d7a1f79cedfc9fcb518596aa839da4de0adb69
URL: https://github.com/llvm/llvm-project/commit/c2d7a1f79cedfc9fcb518596aa839da4de0adb69
DIFF: https://github.com/llvm/llvm-project/commit/c2d7a1f79cedfc9fcb518596aa839da4de0adb69.diff
LOG: [clangd] Add test for FindTarget+RecoveryExpr (which already works). NFC
Added:
Modified:
clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index c38ccc3f9441..cd6f2039c888 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -132,6 +132,16 @@ TEST_F(TargetDeclTest, Exprs) {
EXPECT_DECLS("CXXOperatorCallExpr", "void operator()(int n)");
}
+TEST_F(TargetDeclTest, Recovery) {
+ Code = R"cpp(
+ // error-ok: testing behavior on broken code
+ int f();
+ int f(int, int);
+ int x = [[f]](42);
+ )cpp";
+ EXPECT_DECLS("UnresolvedLookupExpr", "int f()", "int f(int, int)");
+}
+
TEST_F(TargetDeclTest, UsingDecl) {
Code = R"cpp(
namespace foo {
@@ -685,6 +695,15 @@ TEST_F(FindExplicitReferencesTest, All) {
)cpp",
"0: targets = {x}\n"
"1: targets = {X::a}\n"},
+ {R"cpp(
+ // error-ok: testing with broken code
+ int bar();
+ int foo() {
+ return $0^bar() + $1^bar(42);
+ }
+ )cpp",
+ "0: targets = {bar}\n"
+ "1: targets = {bar}\n"},
// Namespaces and aliases.
{R"cpp(
namespace ns {}
More information about the cfe-commits
mailing list