summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2018-09-10 14:22:42 +0000
committerKadir Cetinkaya <kadircet@google.com>2018-09-10 14:22:42 +0000
commit0b77d03d80d609cdb6f3724eeeb7268ee2ca4700 (patch)
treea24e2b79cc33fa9d32336165d8889842c36109b5
parent472e9b0ab20abb211b4a04dbacb5c5dfe424fa7f (diff)
downloadbcm5719-llvm-0b77d03d80d609cdb6f3724eeeb7268ee2ca4700.tar.gz
bcm5719-llvm-0b77d03d80d609cdb6f3724eeeb7268ee2ca4700.zip
[clangd] Add unittests for D51038
Reviewers: ilya-biryukov, ioeric, hokein Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51039 llvm-svn: 341830
-rw-r--r--clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp
index 7e7fde7a9e4..c1010038d98 100644
--- a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp
+++ b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp
@@ -1917,6 +1917,56 @@ TEST(CompletionTest, DeprecatedResults) {
AllOf(Named("TestClangc"), Deprecated())));
}
+TEST(SignatureHelpTest, InsideArgument) {
+ {
+ const auto Results = signatures(R"cpp(
+ void foo(int x);
+ void foo(int x, int y);
+ int main() { foo(1+^); }
+ )cpp");
+ EXPECT_THAT(
+ Results.signatures,
+ ElementsAre(Sig("foo(int x) -> void", {"int x"}),
+ Sig("foo(int x, int y) -> void", {"int x", "int y"})));
+ EXPECT_EQ(0, Results.activeParameter);
+ }
+ {
+ const auto Results = signatures(R"cpp(
+ void foo(int x);
+ void foo(int x, int y);
+ int main() { foo(1^); }
+ )cpp");
+ EXPECT_THAT(
+ Results.signatures,
+ ElementsAre(Sig("foo(int x) -> void", {"int x"}),
+ Sig("foo(int x, int y) -> void", {"int x", "int y"})));
+ EXPECT_EQ(0, Results.activeParameter);
+ }
+ {
+ const auto Results = signatures(R"cpp(
+ void foo(int x);
+ void foo(int x, int y);
+ int main() { foo(1^0); }
+ )cpp");
+ EXPECT_THAT(
+ Results.signatures,
+ ElementsAre(Sig("foo(int x) -> void", {"int x"}),
+ Sig("foo(int x, int y) -> void", {"int x", "int y"})));
+ EXPECT_EQ(0, Results.activeParameter);
+ }
+ {
+ const auto Results = signatures(R"cpp(
+ void foo(int x);
+ void foo(int x, int y);
+ int bar(int x, int y);
+ int main() { bar(foo(2, 3^)); }
+ )cpp");
+ EXPECT_THAT(Results.signatures, ElementsAre(Sig("foo(int x, int y) -> void",
+ {"int x", "int y"})));
+ EXPECT_EQ(1, Results.activeParameter);
+ }
+}
+
} // namespace
} // namespace clangd
} // namespace clang
OpenPOWER on IntegriCloud