all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noah Peart <noah.v.peart@gmail.com>
To: 67235@debbugs.gnu.org
Subject: bug#67235: [PATCH] Fix finding test name with erts-run-test with point-char
Date: Thu, 16 Nov 2023 18:12:52 -0800	[thread overview]
Message-ID: <CAPVBTSc_Jy05kZHdw5kHrGxCv10w2338Ui7zip-Gxehkv8pMHg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1549 bytes --]

Tags: patch


* lisp/progmodes/erts-mode.el(erts-run-test): Fix finding the test name
when Point-Char is defined

Bug: Interactively running a test with `erts-run-test` fails when the
test has a Point-Char definition. When there is a Point-Char definition,
`erts-run-test` calls `(erts-mode--preceding-spec "Point-Char")`,
overwriting the match data expected by `ert-test--erts-test`.

Recipe to reproduce:
Try `M-x erts-run-test` in the indent.erts test from
test/lisp/progmodes/typescript-ts-mode-resources/indent.erts:
[[The following is in `erts-mode`]]

Code:
  (lambda ()
    (setq indent-tabs-mode nil)
    (setq typescript-ts-mode-indent-offset 2)
    (typescript-ts-mode)
    (indent-region (point-min) (point-max)))

Point-Char: |

Name: Basic indentation

=-=
const foo = () => {
  console.log("bar");
  if (x) {
    return y;
  } else if (y) {
    return u;
  }
  return baz.x()
    ? true
    : false;
}
=-=-=

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2023-11-15 built on noah-X580VD
Repository revision: 1a1f47e4a1fb70e6810f9eabd0f1826b71a2bcb0
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.3 LTS

Configured using:
 'configure --prefix=/usr/local --with-modules --with-tree-sitter
--with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls
--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12
CXX=gcc-12'

[-- Attachment #1.2: Type: text/html, Size: 1803 bytes --]

[-- Attachment #2: erts-run-test.patch --]
[-- Type: text/x-patch, Size: 965 bytes --]

From 940fada01383aa053ee7b5f70e3714d8b6954818 Mon Sep 17 00:00:00 2001
From: nverno <noah.v.peart@gmail.com>
Date: Thu, 16 Nov 2023 17:55:59 -0800
Subject: [PATCH] Fix test name with erts-run-test with point-char

---
 lisp/progmodes/erts-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el
index 8dce93eae7e..5ff74082461 100644
--- a/lisp/progmodes/erts-mode.el
+++ b/lisp/progmodes/erts-mode.el
@@ -181,7 +181,8 @@ erts-run-test
         (ert-test--erts-test
          (list (cons 'dummy t)
                (cons 'code (car (read-from-string test-function)))
-               (cons 'point-char (erts-mode--preceding-spec "Point-Char")))
+               (cons 'point-char (save-match-data
+                                   (erts-mode--preceding-spec "Point-Char"))))
          (buffer-file-name))
       (:success (message "Test successful"))
       (ert-test-failed
-- 
2.34.1


             reply	other threads:[~2023-11-17  2:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17  2:12 Noah Peart [this message]
2023-11-25  9:43 ` bug#67235: [PATCH] Fix finding test name with erts-run-test with point-char 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPVBTSc_Jy05kZHdw5kHrGxCv10w2338Ui7zip-Gxehkv8pMHg@mail.gmail.com \
    --to=noah.v.peart@gmail.com \
    --cc=67235@debbugs.gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.