unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "O'Brien, Will" <will.08rien@gmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: Randy Taylor <dev@rjt.dev>, Eli Zaretskii <eliz@gnu.org>,
	74786@debbugs.gnu.org
Subject: bug#74786: [PATCH] Add custom args to test compile step
Date: Wed, 11 Dec 2024 16:31:49 +0000	[thread overview]
Message-ID: <m2r06edvuy.fsf@gmail.com> (raw)
In-Reply-To: <87wmg643g4.fsf@gmail.com> (Robert Pluim's message of "Wed, 11 Dec 2024 16:58:03 +0100")

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

On Wed, Dec 11 2024 at 16:58, Robert Pluim <rpluim@gmail.com> wrote:

>>>>>> On Wed, 11 Dec 2024 17:45:59 +0200, Eli Zaretskii <eliz@gnu.org> said:
>
> Iʼm not Randy, but:
>
>     >> +(defun go-ts-mode--get-test-args ()
>     >> +  "Return the test args.
>     >> +This function respects the `go-ts-mode-test-args' variable for
>     >> +specifying test args, such as adding coverage file."
>     >> +  (if go-ts-mode-test-args
>     >> +      (string-join go-ts-mode-test-args)
>     >> +    ""))
>     >> +
>
> This entire function is not needed, since
>
> (string-join nil) => ""
>
>     >>  (defun go-ts-mode--compile-test (regexp)
>     >>    "Compile the tests matching REGEXP.
>     >>  This function respects the `go-ts-mode-build-tags' variable for
>     >>  specifying build tags."
>     >> -  (compile (format "go test -v %s -run '%s'"
>     >> +  (compile (format "go test %s -v %s -run '%s'"
>     >> +                   (go-ts-mode--get-test-args)
>     >>                     (go-ts-mode--get-build-tags-flag)
>     >>                     regexp)))
>     >> 
>
> so you could just inline the `string-join' here.

Ah, thanks!  I've attached a new patch with the simplification.

best
--
will


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-custom-args-to-test-compile-step.patch --]
[-- Type: text/x-patch, Size: 1228 bytes --]

From 497266302d7ac20be411685c8d7a6dba0126360a Mon Sep 17 00:00:00 2001
From: w08r <will.08rien@gmail.com>
Date: Wed, 11 Dec 2024 09:31:47 +0000
Subject: [PATCH] Add custom args to test compile step

---
 lisp/progmodes/go-ts-mode.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el
index 86e74ad58a8..acf458bf63b 100644
--- a/lisp/progmodes/go-ts-mode.el
+++ b/lisp/progmodes/go-ts-mode.el
@@ -52,6 +52,12 @@
   :type '(repeat string)
   :group 'go)
 
+(defcustom go-ts-mode-test-args nil
+  "List of extra args for the Go test commands."
+  :version "31.1"
+  :type '(repeat string)
+  :group 'go)
+
 (defvar go-ts-mode--syntax-table
   (let ((table (make-syntax-table)))
     (modify-syntax-entry ?+   "."      table)
@@ -396,7 +402,8 @@ specifying build tags."
   "Compile the tests matching REGEXP.
 This function respects the `go-ts-mode-build-tags' variable for
 specifying build tags."
-  (compile (format "go test -v %s -run '%s'"
+  (compile (format "go test %s -v %s -run '%s'"
+                   (string-join go-ts-mode-test-args)
                    (go-ts-mode--get-build-tags-flag)
                    regexp)))
 
-- 
2.32.0


  reply	other threads:[~2024-12-11 16:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 10:18 bug#74786: [PATCH] Add custom args to test compile step O'Brien, Will
2024-12-11 15:45 ` Eli Zaretskii
2024-12-11 15:58   ` Robert Pluim
2024-12-11 16:31     ` O'Brien, Will [this message]
2024-12-11 16:30   ` O'Brien, Will
2024-12-11 17:10     ` Eli Zaretskii

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=m2r06edvuy.fsf@gmail.com \
    --to=will.08rien@gmail.com \
    --cc=74786@debbugs.gnu.org \
    --cc=dev@rjt.dev \
    --cc=eliz@gnu.org \
    --cc=rpluim@gmail.com \
    /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).