unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#67235: [PATCH] Fix finding test name with erts-run-test with point-char
@ 2023-11-17  2:12 Noah Peart
  2023-11-25  9:43 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Noah Peart @ 2023-11-17  2:12 UTC (permalink / raw)
  To: 67235


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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#67235: [PATCH] Fix finding test name with erts-run-test with point-char
  2023-11-17  2:12 bug#67235: [PATCH] Fix finding test name with erts-run-test with point-char Noah Peart
@ 2023-11-25  9:43 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-11-25  9:43 UTC (permalink / raw)
  To: Noah Peart; +Cc: 67235-done

> From: Noah Peart <noah.v.peart@gmail.com>
> Date: Thu, 16 Nov 2023 18:12:52 -0800
> 
> 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`]]

Thanks, installed on master and closing the bug.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-25  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-17  2:12 bug#67235: [PATCH] Fix finding test name with erts-run-test with point-char Noah Peart
2023-11-25  9:43 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).