[clang-tools-extra] cf814fc - [clangd] Add test for structured-binding completion. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 19 07:46:09 PDT 2020
Author: Sam McCall
Date: 2020-10-19T16:45:51+02:00
New Revision: cf814fcd3939a705f8bdf67bcf54cbf821aa6f75
URL: https://github.com/llvm/llvm-project/commit/cf814fcd3939a705f8bdf67bcf54cbf821aa6f75
DIFF: https://github.com/llvm/llvm-project/commit/cf814fcd3939a705f8bdf67bcf54cbf821aa6f75.diff
LOG: [clangd] Add test for structured-binding completion. NFC
Added:
Modified:
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index 510f358920c1..15576eddf76e 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -2579,6 +2579,29 @@ TEST(CompletionTest, Lambda) {
EXPECT_EQ(A.SnippetSuffix, "(${1:int a}, ${2:const double &b})");
}
+TEST(CompletionTest, StructuredBinding) {
+ clangd::CodeCompleteOptions Opts = {};
+
+ auto Results = completions(R"cpp(
+ struct S {
+ using Float = float;
+ int x;
+ Float y;
+ };
+ void function() {
+ const auto &[xxx, yyy] = S{};
+ yyy^
+ }
+ )cpp",
+ {}, Opts);
+
+ ASSERT_EQ(Results.Completions.size(), 1u);
+ const auto &A = Results.Completions.front();
+ EXPECT_EQ(A.Name, "yyy");
+ EXPECT_EQ(A.Kind, CompletionItemKind::Variable);
+ EXPECT_EQ(A.ReturnType, "const Float");
+}
+
TEST(CompletionTest, ObjectiveCMethodNoArguments) {
auto Results = completions(R"objc(
@interface Foo
More information about the cfe-commits
mailing list