[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 6ebbd36 11/45: Add tests for eclipse.jdt.ls conne
From: |
João Távora |
Subject: |
[elpa] externals/eglot 6ebbd36 11/45: Add tests for eclipse.jdt.ls connection |
Date: |
Thu, 22 Nov 2018 19:15:28 -0500 (EST) |
branch: externals/eglot
commit 6ebbd36e18a4da792090c6f7eec349d02f1f9ddc
Author: Michał Krzywkowski <address@hidden>
Commit: mkcms <address@hidden>
Add tests for eclipse.jdt.ls connection
* eglot-tests.el (eglot--have-eclipse-jdt-ls-p): New helper.
(eclipse-connect):
(eclipse-workspace-folders): New tests.
---
eglot-tests.el | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/eglot-tests.el b/eglot-tests.el
index 47a3b34..1b77ad1 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -32,6 +32,13 @@
;; Helpers
+(defun eglot--have-eclipse-jdt-ls-p ()
+ (and (getenv "CLASSPATH")
+ (cl-some
+ (lambda (x)
+ (string-match-p "org\\.eclipse\\.equinox\\.launcher_.*\\.jar$" x))
+ (split-string (getenv "CLASSPATH") ":"))))
+
(defmacro eglot--with-dirs-and-files (dirs &rest body)
(declare (indent 1) (debug t))
`(eglot--call-with-dirs-and-files
@@ -197,6 +204,49 @@ Pass TIMEOUT to `eglot--with-timeout'."
(eglot--with-timeout (or timeout 2)
(apply #'eglot--connect (eglot--guess-contact))))
+(ert-deftest eclipse-connect ()
+ "Connect to eclipse.jdt.ls server."
+ (skip-unless (eglot--have-eclipse-jdt-ls-p))
+ (eglot--with-dirs-and-files
+ '(("project/src/main/java/foo" . (("Main.java" . "")))
+ ("project/.git/" . nil))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/src/main/java/foo/Main.java")
+ (eglot--sniffing (:server-notifications s-notifs)
+ (should (eglot--tests-connect 10))
+ (eglot--wait-for (s-notifs 10)
+ (&key _id method &allow-other-keys)
+ (string= method "language/status"))
+ (ignore-errors (eglot-shutdown (eglot--current-server) nil 10))))))
+
+(ert-deftest eclipse-workspace-folders ()
+ "Check eclipse connection with multi-root projects."
+ (skip-unless (eglot--have-eclipse-jdt-ls-p))
+ (eglot--with-dirs-and-files
+ '(("project/main/src/main/java/foo" . (("Main.java" . "")))
+ ("project/sub1/" . (("pom.xml" . "")))
+ ("project/sub2/" . (("build.gradle" . "")))
+ ("project/sub3/" . (("a.txt" . "")))
+ ("project/.git/" . nil))
+ (let ((root (file-name-as-directory default-directory)))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/main/src/main/java/foo/Main.java")
+ (eglot--sniffing (:client-requests c-reqs)
+ (should (eglot--tests-connect 10))
+ (eglot--wait-for (c-reqs 10)
+ (&key _id method params &allow-other-keys)
+ (when (string= method "initialize")
+ (let ((folders (plist-get
+ (plist-get params :initializationOptions)
+ :workspaceFolders))
+ (default-directory root))
+ (and
+ (seq-contains folders (eglot--path-to-uri "project/"))
+ (seq-contains folders (eglot--path-to-uri "project/sub1/"))
+ (seq-contains folders (eglot--path-to-uri "project/sub2/"))
+ (= 3 (length folders))))))
+ (ignore-errors (eglot-shutdown (eglot--current-server) nil 10)))))))
+
(ert-deftest auto-detect-running-server ()
"Visit a file and M-x eglot, then visit a neighbour. "
(skip-unless (executable-find "rls"))
- [elpa] externals/eglot f250784 10/45: Handle case when project was not found in eclipse.jdt.ls contact, (continued)
- [elpa] externals/eglot f250784 10/45: Handle case when project was not found in eclipse.jdt.ls contact, João Távora, 2018/11/22
- [elpa] externals/eglot c795e3e 09/45: Override eglot-execute-command for eclipse.jdt.ls server, João Távora, 2018/11/22
- [elpa] externals/eglot 5571f10 05/45: Sort references and definitions by line number, João Távora, 2018/11/22
- [elpa] externals/eglot f0b5367 08/45: Per #63: Add support for eclipse.jdt.ls server, João Távora, 2018/11/22
- [elpa] externals/eglot 5b043fb 12/45: * .travis.yml (install): Download eclipse.jdt.ls server., João Távora, 2018/11/22
- [elpa] externals/eglot aefa498 20/45: Larger margin for printing test failure backtraces, João Távora, 2018/11/22
- [elpa] externals/eglot 19aded0 17/45: Remove duplicates from imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 504fd25 14/45: Fix misspelling of "outstanding" (#74), João Távora, 2018/11/22
- [elpa] externals/eglot a406190 07/45: Per #63: Allow function contacts to be interactive, João Távora, 2018/11/22
- [elpa] externals/eglot 27696d6 23/45: Use the container name of a symbol in imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 6ebbd36 11/45: Add tests for eclipse.jdt.ls connection,
João Távora <=
- [elpa] externals/eglot 22e5c57 18/45: Don't ignore unknown SymbolKinds in imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 5ee05f9 16/45: Require subr-x at compile time (#139), João Távora, 2018/11/22
- [elpa] externals/eglot d9c3696 15/45: Fix #138: accept deprecated field in SymbolInformation, João Távora, 2018/11/22
- [elpa] externals/eglot 82ae4f6 21/45: Re-enable eclipse-jdt tests, João Távora, 2018/11/22
- [elpa] externals/eglot ee41f06 22/45: Slightly robustify test engine, João Távora, 2018/11/22
- [elpa] externals/eglot faf93ad 13/45: * eglot-tests.el: Disable eclipse connection tests., João Távora, 2018/11/22
- [elpa] externals/eglot c664f40 28/45: * eglot.el (eglot-client-capabilities): Mention supported SymbolKinds., João Távora, 2018/11/22
- [elpa] externals/eglot edc6538 32/45: Fix a bug introduced by previous bugfix, João Távora, 2018/11/22
- [elpa] externals/eglot d6e0ba3 31/45: * eglot-tests.el (eclipse-connect): Increase connect timeout to 20., João Távora, 2018/11/22
- [elpa] externals/eglot 31bfe21 24/45: Add support for code action literals, João Távora, 2018/11/22