[PATCH] D51039: [clangd] Add unittests for D51038

2018-09-10 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341830: [clangd] Add unittests for D51038 (authored by 
kadircet, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51039?vs=163968=164668#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51039

Files:
  clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp


Index: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
===
--- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
@@ -1917,6 +1917,56 @@
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


Index: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
===
--- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
@@ -1917,6 +1917,56 @@
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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51039: [clangd] Add unittests for D51038

2018-09-10 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51039



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51039: [clangd] Add unittests for D51038

2018-09-04 Thread Kadir Cetinkaya via Phabricator via cfe-commits
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
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51039: [clangd] Add unittests for D51038

2018-08-21 Thread Kadir Cetinkaya via Phabricator via cfe-commits
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


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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits