unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: emacs-29 9c0d7bb73b 2/2: Add automated tests for Eglot
Date: Wed, 14 Dec 2022 12:58:52 +0000	[thread overview]
Message-ID: <CALDnm50JX=kYSuX+caBX8PX7VqfYgkNz_u-nd8VqChc3a3FU4g@mail.gmail.com> (raw)
In-Reply-To: <874jtycnp2.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 3654 bytes --]

On Wed, Dec 14, 2022 at 9:57 AM Michael Albinus <michael.albinus@gmx.de>
wrote:
> > >  Is it possible to give them a unique prefix, like `eglot-test-'?
> >
> > Yes, do that please. I think this makes sense, although the test
> > symbols aren't exactly bound to functions and it is a nuisance to
> > always type this long boring prefix. If only there was some
> > namespacing mechanism in Emacs that could alleviate that.. oh wait ;-)
>
> I've renamed the tests.

Thanks.  But shouldn't it be "eglot-tests" (with trailing 's') to match the
file name eglot-tests.el?  I'm sorry I didn't notice this before.

Also another comment about your earlier commit.

+        (temporary-file-directory ert-remote-temporary-file-directory))
+    ;; We must check the remote LSP server.  So far, just "clangd" is used.
+    (let ((default-directory temporary-file-directory))
+      (unless (executable-find "clangd" 'remote)
+        (ert-skip "Remote clangd not found")))
+    (funcall fn)))

I don't think it's correct to check for "clangd" specifically in
'eglot--call-with-tramp-test', because that restricts its usefulness.

Isn't the following better and still correct?

diff --git a/test/lisp/progmodes/eglot-tests.el
b/test/lisp/progmodes/eglot-tests.el
index d8c9560f5b..509e7e7d82 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -1265,20 +1265,25 @@ eglot--call-with-tramp-test
          (tramp-verbose 1)
          (temporary-file-directory ert-remote-temporary-file-directory)
          (default-directory temporary-file-directory))
-    ;; We must check the remote LSP server.  So far, just "clangd" is used.
-    (unless (executable-find "clangd" 'remote)
-      (ert-skip "Remote clangd not found"))
     (funcall fn)))

+(cl-defmacro eglot--with-tramp-test (() &body body)
+  (declare (indent 1) (debug t))
+  `(eglot--call-with-tramp-test (lambda () ,@body)))
+
 (ert-deftest eglot-test-tramp-test ()
   "Ensure LSP servers can be used over TRAMP."
   :tags '(:expensive-test)
-  (eglot--call-with-tramp-test
#'eglot-tests--auto-detect-running-server-1))
+  (eglot--with-tramp-test ()
+    (skip-unless (executable-find "clangd" 'remote))
+    (eglot-tests--auto-detect-running-server-1)))

 (ert-deftest eglot-test-tramp-test-2 ()
   "Ensure LSP servers can be used over TRAMP."
   :tags '(:expensive-test)
-  (eglot--call-with-tramp-test #'eglot-tests--lsp-abiding-column-1))
+  (eglot--with-tramp-test ()
+    (skip-unless (executable-find "clangd" 'remote))
+    (eglot-tests--lsp-abiding-column-1)))

 (ert-deftest eglot-test-path-to-uri-windows ()
   (skip-unless (eq system-type 'windows-nt))

> But there is no need to type the long test
> names, use completion.

In general completion systems can't guess that I want to make
a test `eglot-test-a-new-test-im-about-to-write`.  And there's also
the clutter of overly long names which seriously impairs readability.
This is a longstanding problem and recurring argument here.  I won't
go into it except to note that if you were to apply this patch:

@@ -1317,4 +1317,5 @@ eglot-test-same-server-multi-mode

 ;; Local Variables:
 ;; checkdoc-force-docstrings-flag: nil
+;; read-symbol-shorthands: (("et-" . "eglot-tests-"))
 ;; End:

then you could just type _and_ read `et-` every time and
the symbol et-foo would be read and interned as
eglot-tests-foo.  And you could keep longhand mentions
to eglot-tests-foo in there as well, and they would also map
to the same symbol.

But this is not allowed practice yet in the Emacs repo.
Unfortunately, IMO.

João

[-- Attachment #2: Type: text/html, Size: 4301 bytes --]

  reply	other threads:[~2022-12-14 12:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <167080394233.4339.5863353994038854528@vcs2.savannah.gnu.org>
     [not found] ` <20221212001223.E9A9DC004BE@vcs2.savannah.gnu.org>
2022-12-12  8:34   ` emacs-29 9c0d7bb73b 2/2: Add automated tests for Eglot Stefan Kangas
2022-12-12  9:52     ` João Távora
2022-12-12 11:26       ` Stefan Kangas
2022-12-12 11:56         ` João Távora
2022-12-12 21:52           ` Stefan Kangas
2022-12-13  8:49             ` Michael Albinus
2022-12-13 19:23               ` Stefan Kangas
2022-12-14  9:55                 ` Michael Albinus
2022-12-12 10:32   ` Michael Albinus
2022-12-12 10:37     ` João Távora
2022-12-13 19:10       ` Michael Albinus
2022-12-13 20:18         ` João Távora
2022-12-14  9:57           ` Michael Albinus
2022-12-14 12:58             ` João Távora [this message]
2022-12-14 14:11               ` Michael Albinus
2022-12-14 15:46                 ` João Távora
2022-12-14 17:41                   ` Stefan Monnier
2022-12-14 21:42                   ` Stefan Kangas
2022-12-15  9:12                     ` Michael Albinus
2022-12-15 12:08                       ` João Távora
2022-12-12 10:59   ` Michael Albinus
2022-12-12 11:03     ` João Távora
2022-12-12 11:08       ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALDnm50JX=kYSuX+caBX8PX7VqfYgkNz_u-nd8VqChc3a3FU4g@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).