aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/eglot-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/progmodes/eglot-tests.el')
-rw-r--r--test/lisp/progmodes/eglot-tests.el58
1 files changed, 56 insertions, 2 deletions
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el
index 0062645ea37..a51ef42d276 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -442,15 +442,69 @@ directory hierarchy."
442 (with-current-buffer 442 (with-current-buffer
443 (eglot--find-file-noselect "diag-project/main.c") 443 (eglot--find-file-noselect "diag-project/main.c")
444 (eglot--sniffing (:server-notifications s-notifs) 444 (eglot--sniffing (:server-notifications s-notifs)
445 (eglot--tests-connect) 445 (eglot--tests-connect :server "clangd")
446 (flymake-start)
446 (eglot--wait-for (s-notifs 10) 447 (eglot--wait-for (s-notifs 10)
447 (&key _id method &allow-other-keys) 448 (&key method &allow-other-keys)
448 (string= method "textDocument/publishDiagnostics")) 449 (string= method "textDocument/publishDiagnostics"))
450 (goto-char (point-min))
451 (flymake-goto-next-error 1 '() t)
452 (should (eq 'flymake-error (face-at-point)))))))
453
454(ert-deftest eglot-test-basic-pull-diagnostics ()
455 "Test basic diagnostics."
456 (skip-unless (executable-find "ty"))
457 (eglot--with-fixture
458 `(("diag-project" .
459 (("main.py" . "def main:\npuss"))))
460 (with-current-buffer
461 (eglot--find-file-noselect "diag-project/main.py")
462 (eglot--sniffing (:server-replies s-replies)
463 (eglot--tests-connect :server "ty server")
449 (flymake-start) 464 (flymake-start)
465 (eglot--wait-for (s-replies 5)
466 (&key _id method &allow-other-keys)
467 (string= method "textDocument/diagnostic"))
450 (goto-char (point-min)) 468 (goto-char (point-min))
451 (flymake-goto-next-error 1 '() t) 469 (flymake-goto-next-error 1 '() t)
452 (should (eq 'flymake-error (face-at-point))))))) 470 (should (eq 'flymake-error (face-at-point)))))))
453 471
472(ert-deftest eglot-test-basic-stream-diagnostics ()
473 "Test basic diagnostics."
474 (skip-unless (executable-find "rass"))
475 (skip-unless (executable-find "ruff"))
476 (skip-unless (executable-find "ty"))
477 (eglot--with-fixture
478 `(("diag-project" .
479 (("main.py" . "from lib import greet\ndef main():\n greet()")
480 ("lib.py" . "def geet():\n print('hello')"))))
481 (set-buffer (eglot--find-file-noselect "diag-project/main.py"))
482 (eglot--sniffing (:server-notifications s-notifs)
483 (eglot--tests-connect :server "rass -- ty server -- ruff server")
484 (flymake-start)
485 (cl-loop repeat 2 ;; 2 stream notifs for 2 rass servers
486 do (eglot--wait-for (s-notifs 5)
487 (&key method &allow-other-keys)
488 (string= method "$/streamDiagnostics")))
489 (goto-char (point-min))
490 (flymake-goto-next-error 1 '() t)
491 (should (eq 'flymake-error (face-at-point))))
492
493 ;; Now fix it
494 (set-buffer (eglot--find-file-noselect "lib.py"))
495 (search-forward "geet")
496 (replace-match "greet")
497 (eglot--sniffing (:server-notifications s-notifs)
498 (eglot--signal-textDocument/didChange)
499 (set-buffer (eglot--find-file-noselect "main.py"))
500 (flymake-start)
501 (cl-loop repeat 2
502 do (eglot--wait-for (s-notifs 5)
503 (&key method &allow-other-keys)
504 (string= method "$/streamDiagnostics")))
505 (goto-char (point-min))
506 (should-error (flymake-goto-next-error 1 '() t)))))
507
454(ert-deftest eglot-test-basic-symlink () 508(ert-deftest eglot-test-basic-symlink ()
455 "Test basic symlink support." 509 "Test basic symlink support."
456 (skip-unless (executable-find "clangd")) 510 (skip-unless (executable-find "clangd"))