Subject: bug#74786: closed (Re: bug#74786: [PATCH] Add custom args to test compile step)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 05 Jan 2025 12:44:02 +0000

Your bug report

#74786: [PATCH] Add custom args to test compile step

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
74786: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74786
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#74786: [PATCH] Add custom args to test compile step
From: Eli Zaretskii <[email-masked]>
To: Randy Taylor <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Sun, 05 Jan 2025 14:43:07 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Sat, 04 Jan 2025 19:05:55 +0000
> From: Randy Taylor <[email-masked]>
> Cc: "J.P." <[email-masked]>, Robert Pluim <[email-masked]>, Eli Zaretskii <[email-masked]>, [email-masked]
> 
> Thanks, looks good to me.
> 
> Eli, please install if you have no further comments. Thanks in
> advance.

Thanks, installed on the master branch, and closing the bug.

Subject: [PATCH] Add custom args to test compile step
From: "O'Brien, Will" <[email-masked]>
To: [email-masked]
Date: Wed, 11 Dec 2024 10:18:04 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Hi,

First time trying to contribute here, so apologies for any wrong doing.  I
haven't signed FSF papers; would be happy to but believe this may fit in to
tiny patch territory.

This is a feature request to pass custom flags down to the test compile
step in go-ts-mode-test-... functions.  Specifically I wanted to
add the coverprofile argument to unit test invocation.

The attached patch seems to do the trick for me.

In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.6.0, NS
 appkit-2487.70 Version 14.6.1 (Build 23G93)) of 2024-09-02 built
 on Wills-MacBook-Pro.local
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.1.1

Configured using:
 'configure --disable-silent-rules
 --prefix=/nix/store/2hqk7brndnbi3r5c2rjyhx0k19m1q77j-w08r-emacs-92ea393a16e
 --enable-locallisppath=/nix/store/2hqk7brndnbi3r5c2rjyhx0k19m1q77j-w08r-emacs-92ea393a16e/site-lisp
 --without-dbus --without-imagemagick --with-mailutils
 --disable-ns-self-contained --with-cairo --with-modules
 --with-xml2 --with-gnutls --with-rsvg --with-native-compilation
 --with-gnutls=ifavailable
 --enable-mac-app=/nix/store/2hqk7brndnbi3r5c2rjyhx0k19m1q77j-w08r-emacs-92ea393a16e/Applications
 --with-xwidgets --with-tree-sitter 'CFLAGS=-O3 -isysroot
 /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/
 -framework AppKit'
 'CPPFLAGS=-I/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include
 -isysroot
 /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/
 -I/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk//System/Library/Frameworks/AppKit.framework/Versions/C/Headers
 -I/nix/store/d3f47kd7kr5xdpcgs3xx7bg2mx5fbb0z-libgccjit-12.2.0/include'
 'LDFLAGS=-O3 -L
 /nix/store/d3f47kd7kr5xdpcgs3xx7bg2mx5fbb0z-libgccjit-12.2.0/lib''

best
--
will

>From 0f3059391479511013c560e16858f453d342cba5 Mon Sep 17 00:00:00 2001
From: w08r <[email-masked]>
Date: Wed, 11 Dec 2024 09:31:47 +0000
Subject: [PATCH] Add custom args to test compile step

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

diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el
index 86e74ad58a8..b926e6d7c64 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-ts-mode 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,11 +398,20 @@ specifying build tags."
       (format "-tags %s" (string-join go-ts-mode-build-tags ","))
     ""))
 
+(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)
+    ""))
+
 (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)))
 
-- 
2.32.0