[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 9cd5f447ab 2/4: Per #681: Add (failing) test for
From: |
ELPA Syncer |
Subject: |
[elpa] externals/eglot 9cd5f447ab 2/4: Per #681: Add (failing) test for "same server multiple modes" |
Date: |
Mon, 26 Sep 2022 06:57:34 -0400 (EDT) |
branch: externals/eglot
commit 9cd5f447ab131c5c002f379701d5be8b859e1e73
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Per #681: Add (failing) test for "same server multiple modes"
* eglot-tests.el (eglot--same-server-multi-mode): New test.
---
eglot-tests.el | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 0146503d9c..c140578a6c 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -1061,7 +1061,7 @@ are bound to the useful return values of
(should (equal guessed-contact '("some-executable"))))))
(ert-deftest eglot-server-programs-simple-missing-executable ()
- (let ((eglot-server-programs '((foo-mode "a-missing-executable.exe")))
+v (let ((eglot-server-programs '((foo-mode "a-missing-executable.exe")))
(major-mode 'foo-mode))
(eglot--guessing-contact (interactive-p prompt-args guessed-class
guessed-contact)
(should (equal (not prompt-args) (not interactive-p)))
@@ -1249,6 +1249,31 @@ are bound to the useful return values of
(should (string-suffix-p "c%3A/Users/Foo/bar.lisp"
(eglot--path-to-uri "c:/Users/Foo/bar.lisp"))))
+(ert-deftest eglot--same-server-multi-mode ()
+ "Check single LSP instance manages multiple modes in same project."
+ (skip-unless (executable-find "clangd"))
+ (let (server)
+ (eglot--with-fixture
+ `(("project" . (("foo.cpp" .
+ "#include \"foolib.h\"
+ int main() { return foo(); }")
+ ("foolib.h" .
+ "#ifdef __cplusplus\nextern \"C\" {\n#endif
+ int foo();
+ #ifdef __cplusplus\n}\n#endif")
+ ("foolib.c" .
+ "#include \"foolib.h\"
+ int foo() {return 42;}"))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/foo.cpp")
+ (should (setq server (eglot--tests-connect))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/foolib.h")
+ (should (eq (eglot-current-server) server)))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/foolib.c")
+ (should (eq (eglot-current-server) server))))))
+
(provide 'eglot-tests)
;;; eglot-tests.el ends here