emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 0d5036061b5: Skip Eglot test if using very old clangd


From: Robert Pluim
Subject: Re: master 0d5036061b5: Skip Eglot test if using very old clangd
Date: Wed, 22 Mar 2023 12:12:20 +0100

>>>>> On Wed, 22 Mar 2023 10:49:41 +0000, João Távora <joaotavora@gmail.com> 
>>>>> said:

    João> On Wed, Mar 22, 2023 at 10:38 AM Robert Pluim <rpluim@gmail.com> 
wrote:
    >> Not all clangd have the version string and only the version string at
    >> the end of 'clangd --version'. Hereʼs one I installed from git earlier:
    >> 
    >> clangd version 16.0.0 (https://github.com/llvm/llvm-project.git 
08d094a0e457360ad8b94b017d2dc277e697ca76)
    >> Features: linux
    >> Platform: x86_64-unknown-linux-gnu
    >> 
    >> So how about the following (or we could just say 'everything
    >> non-space', but Iʼm assuming clangd versions are always made up of
    >> numbers and '.')
    >> 
    >> diff --git c/test/lisp/progmodes/eglot-tests.el 
i/test/lisp/progmodes/eglot-tests.el
    >> index c4b23bfd64e..557bd899ab7 100644
    >> --- c/test/lisp/progmodes/eglot-tests.el
    >> +++ i/test/lisp/progmodes/eglot-tests.el
    >> @@ -317,7 +317,7 @@ eglot--simulate-key-event
    >> (defun eglot--clangd-version ()
    >> "Report on the clangd version used in various tests."
    >> (replace-regexp-in-string
    >> -   ".*version[[:space:]]+\\(.*\\)" "\\1"
    >> +   ".*version[[:space:]]+\\([0-9.]*\\).*" "\\1"
    >> (car (split-string (shell-command-to-string "clangd --version") "\n"))))


    João> Sure, thanks.  Bonus points for getting rid of the split-string
    João> and using a regexp that looks at the whole string and
    João> catches the version.  I tried and failed.

This doesnʼt care where 'version ' appears:

(defun eglot--clangd-version ()
  "Report on the clangd version used in various tests."
  (let ((version (shell-command-to-string "clangd --version")))
    (when (string-match "version[[:space:]]+\\([0-9.]*\\)"
                        version)
      (match-string 1 version))))

Robert
-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]