unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "O'Brien, Will" <will.08rien@gmail.com>
To: Randy Taylor <dev@rjt.dev>
Cc: Robert Pluim <rpluim@gmail.com>,
	74786@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
	"J.P." <jp@neverwas.me>
Subject: bug#74786: [PATCH] Add custom args to test compile step
Date: Thu, 02 Jan 2025 11:21:54 +0000	[thread overview]
Message-ID: <m28qrtea0d.fsf@gmail.com> (raw)
In-Reply-To: <fVi0B3YPasvrpCiggTtcHXjOMksryWljVflJ9LjWn9pKa69TmWAlkMtVuDU7ruK-g8BesvgCSL8xizWe6XKr-Qjc-qw4pS-mcmpYb7fe2Xc=@rjt.dev> (Randy Taylor's message of "Wed, 01 Jan 2025 23:50:32 +0000")

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

On Wed, Jan 01 2025 at 23:50, Randy Taylor <dev@rjt.dev> wrote:

> Thanks, the patch looks good to me.
> There is a typo:
> +  "Return the flags for test invoation."
>                               ^invocation
>

Fixed.

[...]

>> I think that we can remove the `-run` flag from this function.
>> What do others think? Also, should this be a separate bug/patch
>> (if indeed it is a bug) or I can incorporate this change into the
>> current change set.
>> 
>
> I believe you are correct, we can get rid of the -run flag.
> Please incorporate these changes as part of this patch.

Done.

> (Side note, maybe we should actually pass the package to
> go test instead of relying on default directory but
> don't worry about that for this patch).

Will raise a new issue.

best
--
will


[-- 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: 3045 bytes --]

From 71817f2e23148e65add2a32a53d22abc63f5af42 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.  Removed incorrect use of -run flag
---
 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..4c9006b3536 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 invocation."
+  (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 %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:[~2025-01-02 11:21 UTC|newest]

Thread overview: 16+ 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
2024-12-20 16:14             ` O'Brien, Will
2025-01-01 23:50               ` Randy Taylor
2025-01-02 11:21                 ` O'Brien, Will [this message]
2025-01-04 19:05                   ` Randy Taylor
2025-01-05 12:43                     ` Eli Zaretskii
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

  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=m28qrtea0d.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 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).