kadircet updated this revision to Diff 163968.
kadircet added a comment.
Rebase
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D51039
Files:
unittests/clangd/CodeCompleteTests.cpp
Index: unittests/clangd/CodeCompleteTests.cpp
===================================================================
--- unittests/clangd/CodeCompleteTests.cpp
+++ unittests/clangd/CodeCompleteTests.cpp
@@ -1882,6 +1882,56 @@
AllOf(Named("Func"), HasInclude("\"foo.h\""),
Not(InsertInclude()))));
}
+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
Index: unittests/clangd/CodeCompleteTests.cpp
===================================================================
--- unittests/clangd/CodeCompleteTests.cpp
+++ unittests/clangd/CodeCompleteTests.cpp
@@ -1882,6 +1882,56 @@
AllOf(Named("Func"), HasInclude("\"foo.h\""), Not(InsertInclude()))));
}
+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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits