[PATCH] D51039: [clangd] Add unittests for D51038
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 21 08:00:18 PDT 2018
kadircet created this revision.
kadircet added reviewers: ilya-biryukov, ioeric, hokein.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay.
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
@@ -1590,6 +1590,56 @@
ElementsAre(Sig("foo(T, U) -> void", {"T", "U"})));
}
+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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51039.161725.patch
Type: text/x-patch
Size: 1939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180821/b67a79de/attachment.bin>
More information about the cfe-commits
mailing list