all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "O'Brien, Will" <will.08rien@gmail.com>
To: Randy Taylor <dev@rjt.dev>, "J.P." <jp@neverwas.me>
Cc: Robert Pluim <rpluim@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
	74786@debbugs.gnu.org
Subject: bug#74786: [PATCH] Add custom args to test compile step
Date: Thu, 19 Dec 2024 16:20:18 +0000	[thread overview]
Message-ID: <m2frmjprul.fsf@gmail.com> (raw)
In-Reply-To: <m2msgupv2a.fsf@gmail.com> (Will O'Brien's message of "Tue, 17 Dec 2024 08:34:05 +0000")

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

Hi,

On Tue, Dec 17 2024 at 08:34, "O'Brien, Will" <will.08rien@gmail.com> wrote:

> On Sun, Dec 15 2024 at 02:17, Randy Taylor <dev@rjt.dev> wrote:
>
>> On Wednesday, December 11th, 2024 at 11:31, O'Brien, Will <will.08rien@gmail.com> wrote:

[...]


>> +  (compile (format "go test %s -v %s -run '%s'"
>> +                   (string-join go-ts-mode-test-args)
>> With the above in mind, we may want to move the %s to the absolute
>> end so that -args could be used without catastrophe.
>
> Got it.  Right I'll work on this and test out a few options with
> combinations flags.
>
>> This will also need a commit message and a NEWS entry.
>> See the CONTRIBUTE file for details.
>
> Ok, will send new patch with code changes and NEW entry along with
> a commit message.

I believe the attached patch should cover your suggestion, Randy,
as well as incorporating Robert's and J.P.'s suggestions.

I have tried to update NEWS and used a commit message within the
patch which I believe conforms to the requirements laid out in
CONTRIBUTE.

Look forward to hearing your feedback, thank you all for showing
such patience.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Enable-extra-flags-in-go-ts-mode-test-commands.patch --]
[-- Type: text/x-patch, Size: 3013 bytes --]

From d7114eebea210214c4539db2ceb2a344f480a09f Mon Sep 17 00:00:00 2001
From: w08r <will.08rien@gmail.com>
Date: Thu, 19 Dec 2024 09:53:02 +0000
Subject: [PATCH] Enable extra flags in go-ts-mode test commands

* lisp/progmodes/go-ts-mode.el (go-ts-mode-test-flags):
(go-ts-mode--get-test-flags): New custom variable for
controlling test behaviour.
(go-ts-mode--compile-test): Updated to use new test flags
variable for passing extra information to the go test command
line.
(go-ts-mode-test-this-package): Updated to use new test flags
variable for passing extra information to the go test command
line.
---
 etc/NEWS                     |  4 ++++
 lisp/progmodes/go-ts-mode.el | 22 ++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 3efce149dbf..59248f79672 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -463,6 +463,10 @@ package of the current buffer.  It is bound to 'C-c C-t p' in 'go-ts-mode'.
 The 'go-ts-mode-build-tags' user option is available to set a list of
 build tags for the test commands.
 
+The 'go-ts-mode-test-flags' user option is available to set a list of
+additional flags to pass to the go test command line.
+
+
 ** C-ts mode
 
 +++
diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el
index 86e74ad58a8..36cb95856b7 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-flags nil
+  "List of extra flags 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)
@@ -392,13 +398,20 @@ specifying build tags."
       (format "-tags %s" (string-join go-ts-mode-build-tags ","))
     ""))
 
+(defun go-ts-mode--get-test-flags ()
+  "Return the flags for test invoation."
+  (if go-ts-mode-test-flags
+      (mapconcat #'shell-quote-argument go-ts-mode-test-flags " ")
+    ""))
+
 (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 -v %s -run '%s' %s"
                    (go-ts-mode--get-build-tags-flag)
-                   regexp)))
+                   regexp
+                   (go-ts-mode--get-test-flags))))
 
 (defun go-ts-mode--find-defun-at (start)
   "Return the first defun node from START."
@@ -457,9 +470,10 @@ be run."
 (defun go-ts-mode-test-this-package ()
   "Run all the unit tests under the current package."
   (interactive)
-  (compile (format "go test -v %s -run %s"
+  (compile (format "go test -v %s -run %s %s"
                    (go-ts-mode--get-build-tags-flag)
-                   default-directory)))
+                   default-directory
+                   (go-ts-mode--get-test-flags))))
 
 ;; go.mod support.
 
-- 
2.32.0


  reply	other threads:[~2024-12-19 16:20 UTC|newest]

Thread overview: 12+ 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
2024-12-15  2:17       ` Randy Taylor
2024-12-17  8:34         ` O'Brien, Will
2024-12-19 16:20           ` O'Brien, Will [this message]
2024-12-20 16:14             ` O'Brien, Will
2024-12-17  2:41       ` J.P.
2024-12-17  8:32         ` O'Brien, Will
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

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

  git send-email \
    --in-reply-to=m2frmjprul.fsf@gmail.com \
    --to=will.08rien@gmail.com \
    --cc=74786@debbugs.gnu.org \
    --cc=dev@rjt.dev \
    --cc=eliz@gnu.org \
    --cc=jp@neverwas.me \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.