[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 1.2 6067ec6 023/101: Minor fixes to test infrastructure
From: |
Christian Johansson |
Subject: |
[elpa] 1.2 6067ec6 023/101: Minor fixes to test infrastructure |
Date: |
Thu, 29 Apr 2021 15:08:53 -0400 (EDT) |
tag: 1.2
commit 6067ec63fa375acb47e65f4fbbecc1f2ed3105df
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Minor fixes to test infrastructure
* eglot-tests.el (eglot--with-timeout): Eval timeout.
(eglot--wait-for): Pass a list to eglot--with-timeout.
(eglot--tests-connect): Take optional timeout arg.
(formatting): Fix indentation and whitespace.vc ne
* Makefile (eglot-check): Load eglot directly to prevent loading
outdated version from ELPA/MELPA.
---
Makefile | 1 +
eglot-tests.el | 50 +++++++++++++++++++++++++-------------------------
2 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/Makefile b/Makefile
index 89cd593..a9d63e9 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,7 @@ compile: $(ELCFILES)
eglot-check: compile
$(EMACS) -Q --batch $(LOAD_PATH) \
$(JSONRPC) \
+ -l eglot \
-l eglot-tests \
--eval '(ert-run-tests-batch-and-exit (quote $(SELECTOR)))'
diff --git a/eglot-tests.el b/eglot-tests.el
index 6940fcd..510573b 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -85,7 +85,7 @@
(cl-defmacro eglot--with-timeout (timeout &body body)
(declare (indent 1) (debug t))
- `(eglot--call-with-timeout ',timeout (lambda () ,@body)))
+ `(eglot--call-with-timeout ,timeout (lambda () ,@body)))
(defun eglot--call-with-timeout (timeout fn)
(let* ((tag (gensym "eglot-test-timeout"))
@@ -163,8 +163,8 @@
"Spin until FN match in EVENTS-SYM, flush events after it.
Pass TIMEOUT to `eglot--with-timeout'."
(declare (indent 2) (debug (sexp sexp sexp &rest form)))
- `(eglot--with-timeout (,timeout ,(or message
- (format "waiting for:\n%s"
(pp-to-string body))))
+ `(eglot--with-timeout '(,timeout ,(or message
+ (format "waiting for:\n%s"
(pp-to-string body))))
(let ((event
(cl-loop thereis (cl-loop for json in ,events-sym
for method = (plist-get json :method)
@@ -196,8 +196,8 @@ Pass TIMEOUT to `eglot--with-timeout'."
(define-derived-mode rust-mode prog-mode "Rust"))
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
-(defun eglot--tests-connect ()
- (eglot--with-timeout 2
+(defun eglot--tests-connect (&optional timeout)
+ (eglot--with-timeout (or timeout 2)
(apply #'eglot--connect (eglot--guess-contact))))
(ert-deftest auto-detect-running-server ()
@@ -381,26 +381,26 @@ Pass TIMEOUT to `eglot--with-timeout'."
(or (executable-find "yapf")
(executable-find "autopep8"))))
(eglot--with-dirs-and-files
- '(("project" . (("something.py" . "def a():pass\ndef b():pass"))))
- (with-current-buffer
- (eglot--find-file-noselect "project/something.py")
- (should (eglot--tests-connect))
- (search-forward "b():pa")
- (eglot-format (point-at-bol) (point-at-eol))
- (should (looking-at "ss"))
- (should
- (or
- ;; yapf
- (string= (buffer-string) "def a():pass\n\n\ndef b():\n pass\n")
- ;; autopep8
- (string= (buffer-string) "def a():pass\n\n\ndef b(): pass\n")))
- (eglot-format-buffer)
- (should
- (or
- ;; yapf
- (string= (buffer-string) "def a():\n pass\n\n\ndef b():\n pass\n")
- ;; autopep8
- (string= (buffer-string) "def a(): pass\n\n\ndef b(): pass\n"))))))
+ '(("project" . (("something.py" . "def a():pass\ndef b():pass"))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/something.py")
+ (should (eglot--tests-connect))
+ (search-forward "b():pa")
+ (eglot-format (point-at-bol) (point-at-eol))
+ (should (looking-at "ss"))
+ (should
+ (or
+ ;; yapf
+ (string= (buffer-string) "def a():pass\n\n\ndef b():\n pass\n")
+ ;; autopep8
+ (string= (buffer-string) "def a():pass\n\n\ndef b(): pass\n")))
+ (eglot-format-buffer)
+ (should
+ (or
+ ;; yapf
+ (string= (buffer-string) "def a():\n pass\n\n\ndef b():\n
pass\n")
+ ;; autopep8
+ (string= (buffer-string) "def a(): pass\n\n\ndef b(): pass\n"))))))
(ert-deftest javascript-basic ()
"Test basic autocompletion in a python LSP"
- [elpa] 1.2 7f8465c 025/101: Add a generic eglot-execute-command API, (continued)
- [elpa] 1.2 7f8465c 025/101: Add a generic eglot-execute-command API, Christian Johansson, 2021/04/29
- [elpa] 1.2 d0ec044 041/101: Add go-langserver (#74), Christian Johansson, 2021/04/29
- [elpa] 1.2 6cbfdda 057/101: Make eglot-ignored-server-capabilites more user-friendly (#126), Christian Johansson, 2021/04/29
- [elpa] 1.2 d54e494 046/101: Ignore extra keys in textDocument/publishDiagnostics (#81), Christian Johansson, 2021/04/29
- [elpa] 1.2 2d3c391 007/101: Close #48: be less verbose when using eglot-ensure, Christian Johansson, 2021/04/29
- [elpa] 1.2 9c2fd8c 002/101: Close #44: Robustify in the face of manual mode changes, Christian Johansson, 2021/04/29
- [elpa] 1.2 4d80eeb 015/101: Default eglot-handle-notifictiona|request must &allow-other-keys, Christian Johansson, 2021/04/29
- [elpa] 1.2 d2faf6d 001/101: Close #29: Implement workspace/didChangeConfiguration (#40), Christian Johansson, 2021/04/29
- [elpa] 1.2 5aea589 013/101: Close #58: Erase company-doc buffer in between doc requests, Christian Johansson, 2021/04/29
- [elpa] 1.2 5707785 024/101: * eglot.el (eglot-cquery): Capitalize docstring., Christian Johansson, 2021/04/29
- [elpa] 1.2 6067ec6 023/101: Minor fixes to test infrastructure,
Christian Johansson <=
- [elpa] 1.2 13b8c61 040/101: Per #74: Don't error if server replies with empty hover message, Christian Johansson, 2021/04/29
- [elpa] 1.2 53c8f59 059/101: Handle case when diagnostic :character is out of range, Christian Johansson, 2021/04/29
- [elpa] 1.2 1408860 052/101: Close #94: Prefer ccls over cquery for C/C++, Christian Johansson, 2021/04/29
- [elpa] 1.2 a1e8946 045/101: Close #80: Consider :triggerCharacters in company completion, Christian Johansson, 2021/04/29
- [elpa] 1.2 989647a 049/101: When exiting emacs, don't ask the user to confirm killing processes (#83), Christian Johansson, 2021/04/29
- [elpa] 1.2 ce9076d 047/101: Close #82: Correctly delete text before expanding snippet completions, Christian Johansson, 2021/04/29
- [elpa] 1.2 746505f 072/101: Require subr-x at compile time (#139), Christian Johansson, 2021/04/29
- [elpa] 1.2 eec30e3 070/101: Fix misspelling of "outstanding" (#74), Christian Johansson, 2021/04/29
- [elpa] 1.2 ff62057 071/101: Fix #138: accept deprecated field in SymbolInformation, Christian Johansson, 2021/04/29
- [elpa] 1.2 f317a7d 069/101: * eglot-tests.el: Disable eclipse connection tests., Christian Johansson, 2021/04/29