From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ankit Gadiya via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70939: [PATCH] Add commands to run unit tests in go-ts-mode Date: Wed, 29 May 2024 01:28:38 +0530 Message-ID: References: <868r0ajh5j.fsf@gnu.org> <86bk55iw54.fsf@gnu.org> Reply-To: Ankit Gadiya Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9472"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 70939@debbugs.gnu.org To: Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 28 22:01:06 2024 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 1sC30L-0002GJ-S1 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 May 2024 22:01:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sC30D-0002Jq-Bd; Tue, 28 May 2024 16:00:58 -0400 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 1sC308-0002IO-UZ for bug-gnu-emacs@gnu.org; Tue, 28 May 2024 16:00:54 -0400 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 1sC308-000839-J5 for bug-gnu-emacs@gnu.org; Tue, 28 May 2024 16:00:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sC30H-0002Vl-Mn for bug-gnu-emacs@gnu.org; Tue, 28 May 2024 16:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ankit Gadiya Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 May 2024 20:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70939-submit@debbugs.gnu.org id=B70939.17169264089449 (code B ref 70939); Tue, 28 May 2024 20:01:01 +0000 Original-Received: (at 70939) by debbugs.gnu.org; 28 May 2024 20:00:08 +0000 Original-Received: from localhost ([127.0.0.1]:54974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sC2zQ-0002SK-4v for submit@debbugs.gnu.org; Tue, 28 May 2024 16:00:08 -0400 Original-Received: from mail-vs1-f46.google.com ([209.85.217.46]:51352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sC2zO-0002RY-VR for 70939@debbugs.gnu.org; Tue, 28 May 2024 16:00:07 -0400 Original-Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-48a39be0e32so383234137.2 for <70939@debbugs.gnu.org>; Tue, 28 May 2024 12:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=argp.in; s=google; t=1716926332; x=1717531132; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=D535+Nz3VWioln+eyCE8hs/AfGGYcnhiRhka4fJZxxU=; b=hXMfQ7zYnprarYELSUkagiCJaGamlQt2rzCxZ2LpuQxFDXvbxRjbUCVunYhymeSDLX /jkMvpanDowB1pLIlmg6nE00uI0KMnQIR+Dv3fVlpH1DRVXhF0+p7edI4Gw6H/FIpjBz IVfh7vEtWK+yp32Kg/eixQq2hoAWWi6dQUrbb2sy56pQlNd/ibD0/0AmzhBF4XaCce9C 8cExE3kYCokUn9vXfz/MiGKWzyCF10lh9xsdVysf7bCeHn7/MzHn8QcvPEub12EAmbSi PoDKOlT0w2yWCUdT5zTuf7+6ryyGvOg0ncoYciMalhvEJQEkTTJfT5p7xwbk/5+6zfWY z/Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716926332; x=1717531132; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D535+Nz3VWioln+eyCE8hs/AfGGYcnhiRhka4fJZxxU=; b=FB2nUIHuGNW3BgtCrv1PXdl0MR75oFiCGt88/1f+FLRR8d7qs27exC84h2TPBo08GY IHRlb3W8bSI4BQI9LICTkc31XBPWpnO/LBi00FyW5dkIG3YnQK249W1jG3xdD0Xd5YAn rvh7cxNdCiayrD9y60Z7qsu8t9DxOJ5MGBiQBfolzQGHop1VI/6yLnLbcvsIoLv13XDU 50m6BIO1cZl8w1jIJHOtVv1XoV83pOOAE+Ky4Uv9OoYqq5Su6OmOEECgrMZv6wUrYMJc yjmhs8D4RZJoIn2O9V9WUznGiImgcZCJs2UhcGikpG1A2t2qEa+kIkAf7WIP4m/+XDPk q5dQ== X-Forwarded-Encrypted: i=1; AJvYcCXQadGg79Fu/lPo4DI2rEIdf5KJN2XCOjlTv/B7km5vpb2m5ufGsfIdoQ5QR1Hfup9pp8+eVEep9LxuzZXalo5qBXmrHlA= X-Gm-Message-State: AOJu0Yxv91gR7FPXqLzzbLeBH0BH5rpGD6s0oien8bUtBarHZX2vQy6w MCfDGuNPBORNKRdCK2PLVVDT66C7kx78EDSCb3fLdcA0IPwLlVJJJx2ybvi44s+zwnOQQJPobwN ZycvuSWa/RlMXjj69uklvDNEOdCZ/pRIikH33inviY8QDHm4v4zV0yw== X-Google-Smtp-Source: AGHT+IEsHp/6J/a+yd2FQrHCKsnS2B99xcm9vPZmMhYKIFXk2aw7SeE4+HvOzdzF4Cq5YtqIWzlLZQXlJzpxpMCSQZw= X-Received: by 2002:a05:6102:f11:b0:48a:2e81:6671 with SMTP id ada2fe7eead31-48a386ccc4bmr16922545137.34.1716926329891; Tue, 28 May 2024 12:58:49 -0700 (PDT) In-Reply-To: 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:286123 Archived-At: > > Sorry for the delay in reviewing, I've been having internet troubles since last Friday. I'll take a look at this next week. No issues, appreciate the review. > > A few quick things I noticed on a glance: > > > > + (let* ((node (go-ts-mode--find-defun-at start)) > > + (name (treesit-defun-name node)) > > > > Indentation is off on the name line - looks like a TAB was used? Should only be spaces everywhere. Double check the rest is OK. > > > > +region. It is bound to 'C-c C-t' in 'go-ts-mode'. > > ^ C-c C-t t > > > > +package of the current buffer. It is bound to 'C-c C-p' in 'go-ts-mode'. > > ^ C-c C-t p > > > > + "List of go build tags for the test commands." > > ^ Go > > > > + "Return a list with names of all defuns in the range." > > We should probably say what the range actually is (START to END) - not sure if we have a convention for that wording already. > > A few more nits: > + "Return compile flag for build tags. > ^ the > > +This function respects `go-ts-mode-build-tags' variable for specifying > ^ the > > + "Return a list with names of all defuns in the range." > ^ the > > Indentation is also off in go-ts-mode-test-function-at-point. Thanks. I learned about whitespace-mode and checkdoc. I'll be running my changes through it before sending the path now. Please let me know if there are any other checks I can do in the future. > When we run C-c C-t t outside of a function, we get: > go test -v -run '^nil$' > Should we maybe not bother running anything at all? What do you think? > Do we know how other packages behave under similar circumstances? I'll check the packages and find out how it is handled elsewhere. One point of reference can be Doom Emacs configuration. It uses the re-search-(backward|forward) functions that throw an error if no match is found. I'm also planning to add a third function to run all the tests in the current file using the buffer-beginning and buffer-end as the range. I'll submit it in the next patch along with the suggested fixes. -- Ankit