GNU bug report logs - #74786
[PATCH] Add custom args to test compile step

Previous Next

Package: emacs;

Reported by: "O'Brien, Will" <will.08rien <at> gmail.com>

Date: Wed, 11 Dec 2024 11:29:02 UTC

Severity: wishlist

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 74786 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Randy Taylor <dev <at> rjt.dev>, "O'Brien, Will" <will.08rien <at> gmail.com>,
 74786 <at> debbugs.gnu.org
Subject: Re: bug#74786: [PATCH] Add custom args to test compile step
Date: Wed, 11 Dec 2024 16:58:03 +0100
>>>>> On Wed, 11 Dec 2024 17:45:59 +0200, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: "O'Brien, Will" <will.08rien <at> gmail.com>
    >> Date: Wed, 11 Dec 2024 10:18:04 +0000
    >> 
    >> 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.

    Eli> It does.  But you may wish to start the paperwork regardless, so we
    Eli> could accept your future contributions without limitations.  Let me
    Eli> know if you want me to send you the form and instructions.

    >> 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.

    Eli> Thanks.

    Eli> Randy, any comments or suggestions?

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.


Robert
-- 




This bug report was last modified 136 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.