[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 1.2 71012bc 067/101: Add tests for eclipse.jdt.ls connection
From: |
Christian Johansson |
Subject: |
[elpa] 1.2 71012bc 067/101: Add tests for eclipse.jdt.ls connection |
Date: |
Thu, 29 Apr 2021 15:09:02 -0400 (EDT) |
tag: 1.2
commit 71012bc24e2a6019ea010fc634b4f43af45b015e
Author: MichaĆ Krzywkowski <k.michal@zoho.com>
Commit: mkcms <k.michal@zoho.com>
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] 1.2 c2e05a3 030/101: Close #68: Implement asynchronous server connection, (continued)
- [elpa] 1.2 c2e05a3 030/101: Close #68: Implement asynchronous server connection, Christian Johansson, 2021/04/29
- [elpa] 1.2 3432d21 037/101: Per #74: Fix eglot-capabilities when querying for multiple features, Christian Johansson, 2021/04/29
- [elpa] 1.2 6eac51f 061/101: Sort references and definitions by line number, Christian Johansson, 2021/04/29
- [elpa] 1.2 88a4f8c 044/101: Actually add snippet example gif referenced in README.md, Christian Johansson, 2021/04/29
- [elpa] 1.2 29d641b 066/101: Handle case when project was not found in eclipse.jdt.ls contact, Christian Johansson, 2021/04/29
- [elpa] 1.2 2971683 075/101: Rework test macros for hopefully more stable testing, Christian Johansson, 2021/04/29
- [elpa] 1.2 3b3c1db 036/101: Close #73: Prompt for server in interactive eglot-shutdown, Christian Johansson, 2021/04/29
- [elpa] 1.2 a1cc0ad 043/101: * README.md (Obligatory animated gif section): Add snippet gif., Christian Johansson, 2021/04/29
- [elpa] 1.2 3532bd0 064/101: Per #63: Add support for eclipse.jdt.ls server, Christian Johansson, 2021/04/29
- [elpa] 1.2 0ef245f 051/101: Fix serious breakage introduced by #93, Christian Johansson, 2021/04/29
- [elpa] 1.2 71012bc 067/101: Add tests for eclipse.jdt.ls connection,
Christian Johansson <=
- [elpa] 1.2 ea2fcc7 087/101: * eglot-tests.el (eclipse-connect): Increase connect timeout to 20., Christian Johansson, 2021/04/29
- [elpa] 1.2 7f1a0e3 100/101: * eglot.el (eglot-completion-at-point): Less chatter., Christian Johansson, 2021/04/29
- [elpa] 1.2 477e15d 018/101: * eglot.el (eglot-initialization-options): Fix spurious typo., Christian Johansson, 2021/04/29
- [elpa] 1.2 802dea3 033/101: Close #41: Control the size of the events buffer, Christian Johansson, 2021/04/29
- [elpa] 1.2 8ed2524 038/101: Close #50: Support snippet completions, Christian Johansson, 2021/04/29
- [elpa] 1.2 7583849 058/101: eglot-ignored-server-capabilites: Prefer all choices over "Other", Christian Johansson, 2021/04/29
- [elpa] 1.2 240f88c 050/101: Don't warn on implementation-specific notifications (#93), Christian Johansson, 2021/04/29
- [elpa] 1.2 ba9877f 048/101: Close #86: Handle case when :textDocumentSync isn't a number, Christian Johansson, 2021/04/29
- [elpa] 1.2 6788dbc 074/101: Don't ignore unknown SymbolKinds in imenu, Christian Johansson, 2021/04/29
- [elpa] 1.2 9bf41be 076/101: Larger margin for printing test failure backtraces, Christian Johansson, 2021/04/29