Skip to content

Commit 0b77d03

Browse files
committedSep 10, 2018
[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
1 parent 472e9b0 commit 0b77d03

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
 

‎clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp

+50
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,56 @@ TEST(CompletionTest, DeprecatedResults) {
19171917
AllOf(Named("TestClangc"), Deprecated())));
19181918
}
19191919

1920+
TEST(SignatureHelpTest, InsideArgument) {
1921+
{
1922+
const auto Results = signatures(R"cpp(
1923+
void foo(int x);
1924+
void foo(int x, int y);
1925+
int main() { foo(1+^); }
1926+
)cpp");
1927+
EXPECT_THAT(
1928+
Results.signatures,
1929+
ElementsAre(Sig("foo(int x) -> void", {"int x"}),
1930+
Sig("foo(int x, int y) -> void", {"int x", "int y"})));
1931+
EXPECT_EQ(0, Results.activeParameter);
1932+
}
1933+
{
1934+
const auto Results = signatures(R"cpp(
1935+
void foo(int x);
1936+
void foo(int x, int y);
1937+
int main() { foo(1^); }
1938+
)cpp");
1939+
EXPECT_THAT(
1940+
Results.signatures,
1941+
ElementsAre(Sig("foo(int x) -> void", {"int x"}),
1942+
Sig("foo(int x, int y) -> void", {"int x", "int y"})));
1943+
EXPECT_EQ(0, Results.activeParameter);
1944+
}
1945+
{
1946+
const auto Results = signatures(R"cpp(
1947+
void foo(int x);
1948+
void foo(int x, int y);
1949+
int main() { foo(1^0); }
1950+
)cpp");
1951+
EXPECT_THAT(
1952+
Results.signatures,
1953+
ElementsAre(Sig("foo(int x) -> void", {"int x"}),
1954+
Sig("foo(int x, int y) -> void", {"int x", "int y"})));
1955+
EXPECT_EQ(0, Results.activeParameter);
1956+
}
1957+
{
1958+
const auto Results = signatures(R"cpp(
1959+
void foo(int x);
1960+
void foo(int x, int y);
1961+
int bar(int x, int y);
1962+
int main() { bar(foo(2, 3^)); }
1963+
)cpp");
1964+
EXPECT_THAT(Results.signatures, ElementsAre(Sig("foo(int x, int y) -> void",
1965+
{"int x", "int y"})));
1966+
EXPECT_EQ(1, Results.activeParameter);
1967+
}
1968+
}
1969+
19201970
} // namespace
19211971
} // namespace clangd
19221972
} // namespace clang

0 commit comments

Comments
 (0)