From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "O'Brien, Will" Newsgroups: gmane.emacs.bugs Subject: bug#74786: [PATCH] Add custom args to test compile step Date: Thu, 02 Jan 2025 11:21:54 +0000 Message-ID: References: <86wmg62pfs.fsf@gnu.org> <87wmg643g4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27769"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Robert Pluim , 74786@debbugs.gnu.org, Eli Zaretskii , "J.P." To: Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 02 12:23:16 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tTJII-00073G-RS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Jan 2025 12:23:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTJIB-0002fK-Ui; Thu, 02 Jan 2025 06:23:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTJI6-0002f1-OD for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 06:23:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTJI6-0003ec-G0 for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 06:23:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=eP+538ixbCvEhZrp/BgCDywzUW2E2+yzI4OLDK24thU=; b=EYJiGZchyMYAVD1Wp8/znjnzCVceJjvEKv0SYuQN3cVGfo0OEWxF+ih3THQ6riN0IFWh+tOp165df7x+KXC+ZbBKr+XrwiOTzjUIyKcMDOJ+y3n6ySHVnZRDcsk0ixqHcgdxXQV+t6TTfAQzAFG2luFhBz3JV/IrFDYWQx9q8ZyJqCLBEPJsuIv79vpacNr/rI6b0TmOERt8oDUeTXPssonYLlPG87eZ9eBtlxhHA34QDN4/5Wg5U9VVDE8xGRBfguzKkPxTZoZl2WYnVETKH+IzW+I6FwqZbEC5Z7OaSc7ErtGpAKCM+X4u3W8glZnZVaAiW3xomxU+RSbwr3DQnw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTJI6-00031J-95 for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 06:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "O'Brien, Will" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Jan 2025 11:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74786 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74786-submit@debbugs.gnu.org id=B74786.173581692611536 (code B ref 74786); Thu, 02 Jan 2025 11:23:02 +0000 Original-Received: (at 74786) by debbugs.gnu.org; 2 Jan 2025 11:22:06 +0000 Original-Received: from localhost ([127.0.0.1]:42911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTJHB-0002zz-DE for submit@debbugs.gnu.org; Thu, 02 Jan 2025 06:22:05 -0500 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:59526) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tTJH8-0002zT-Rj for 74786@debbugs.gnu.org; Thu, 02 Jan 2025 06:22:04 -0500 Original-Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3862df95f92so4880052f8f.2 for <74786@debbugs.gnu.org>; Thu, 02 Jan 2025 03:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735816916; x=1736421716; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=eP+538ixbCvEhZrp/BgCDywzUW2E2+yzI4OLDK24thU=; b=UzPj/uVM9+rhVxs1oqyEdxItvu96JVnHI8R1/JCy8VpvnduNaSUI6y9Xk2CEaayRQW 02mkuLCG5KXKLz5OCCK3yej7RTTNhxe1OSGyY5fSpzkW1XejWvJjJ149RPgGWIFLe7Ht qm5wfH8/B9CqEa/VG9mnMQwjxAqHvIvQ1NKGaaiuNwK++PDmrZUr6670OGB9/vscvXtC yG1DSUkgRJLrMtLfhy/eRr16wknkSEK2/O85HFbCu+IODW8XQgILQxAKvpNW7GzLZZzp +cFRGpkYwkMauXCHyWUxyQJ/7Roho9blQ7ye/MPV1o7E+hcesCDe3YiNwX/G/3FhQL3K PsGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735816916; x=1736421716; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eP+538ixbCvEhZrp/BgCDywzUW2E2+yzI4OLDK24thU=; b=UP/8h8RXkec4lR3q6uMXxpAEjDjOyttuZO3tJtpHpA8ITv0c3SXcJLAuexdqNdmhOn KPV4XWvEwqNaujjtdMY5G/2XDMw264rb3IAK2St8QCMeDMIebN6Qk1hIUjmivEM19ZlB 79Lo+hctRT2sVbF+ke1AxvenIoAmeCFUWs0tsMsLjIhVDZzOv9MfN6jepmCOfwm/+9wH Na/oytAfQtqfDs+k+EzjK+4l7ImwP1dCsWLWytx+pOKXehNXc64WPYBqZx9pbRFuA4ye FjyCbOOXEd/BFfQuSUFscTdb14foKR4w1FzcPKLIaWPsmrbQEEusIDeroq4HXHFo6BHr P9qQ== X-Forwarded-Encrypted: i=1; AJvYcCWGVbMS7pY1xXHH3o+KsJZEjqus4Gung+yW9x9a5MJdzNVsFx1r3CPkNiaOwNDFw1QAOPOmew==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxSeHY2Tfx/+6hHMVT8UICYHyGHiNFONyCQBPPU07R0bS9QKClN 63S+n5YIKqhYqrcA/Ymaq6f/JcusZ4gB6ksdLIzlptu2sTnaByrc X-Gm-Gg: ASbGncsb+l/Lkva3jfFeHM/dZGtBM3w4SEvrJ+WTu8B7QE7mdxSausMu0En7xzhVlHK gFjxQE2BF8vf81QGU1TFq5kH/7nR7icUlOIep32lJTfmqkq7P103daus/ZoDvHabfFvbZ6rfJo2 FFYJpJvbeQudxLeK9GusAAvEJpX73foyYPi/NBR0GnObXWnPaz7THtDGX+eVRZ1iUbkjzAyaQ4I p2Rbx7oRebHztFGL7uDwX3YHEdfoZ5QrH5tL5L9bax6F5i15/MiNgbF7i921sr6qHhtUCLQI765 XOhC0LtharzhU5oWZ/76 X-Google-Smtp-Source: AGHT+IH/g+pFUcSwJrz3hKHnOsqAM4d/9ZGN8AdCJ0irFfIvhMlxvAFqByLG3HifrA5K2uFCudpHQA== X-Received: by 2002:a05:6000:4023:b0:385:f220:f788 with SMTP id ffacd0b85a97d-38a223fd77bmr40734554f8f.48.1735816916283; Thu, 02 Jan 2025 03:21:56 -0800 (PST) Original-Received: from Wills-MacBook-Pro.local ([2a00:23c7:253d:cd01:80ed:4520:1152:3675]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8a8d32sm38163620f8f.99.2025.01.02.03.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 03:21:55 -0800 (PST) In-Reply-To: (Randy Taylor's message of "Wed, 01 Jan 2025 23:50:32 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298160 Archived-At: --=-=-= Content-Type: text/plain On Wed, Jan 01 2025 at 23:50, Randy Taylor 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Enable-extra-flags-in-go-ts-mode-test-commands.patch >From 71817f2e23148e65add2a32a53d22abc63f5af42 Mon Sep 17 00:00:00 2001 From: w08r 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 --=-=-=--