[clang-tools-extra] r341830 - [clangd] Add unittests for D51038
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 10 07:22:42 PDT 2018
Author: kadircet
Date: Mon Sep 10 07:22:42 2018
New Revision: 341830
URL: http://llvm.org/viewvc/llvm-project?rev=341830&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
Modified: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp?rev=341830&r1=341829&r2=341830&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Mon Sep 10 07:22:42 2018
@@ -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
More information about the cfe-commits
mailing list