unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66312: 30.0.50; erts-run-test always fails
@ 2023-10-02 19:25 Augustin Chéneau
  2024-05-18 21:52 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 2+ messages in thread
From: Augustin Chéneau @ 2023-10-02 19:25 UTC (permalink / raw)
  To: 66312

[-- Attachment #1: Type: text/plain, Size: 3849 bytes --]


Every time I try to use the command `erts-run-test' in erts files (such
as emacs/test/lisp/progmodes/java-ts-mode-resources/indent.erts), it
fails with the message "No name for test case".  The culprits lies in
`ert-test--erts-test' which depends on the result of a regex search run 
in another function (with match-beginning).

It probably works in batch mode (I don't know how to use it), but in
erts-mode the search is not executed so the function is not run 
correctly and fails.

By the way, is there any resource about running erts files? I looked in
the ERT manual, but there is only information on writing erts files and
executing regular ERT files.


In GNU Emacs 30.0.50 (build 23, x86_64-pc-linux-gnu, GTK+ Version
  3.24.38, cairo version 1.18.0) of 2023-10-02 built on inspiron-5567
Repository revision: 6295f2d44fa26ed141309481ec9ea1640d75e490
Repository branch: html-js-css
Windowing system distributor 'The X.Org Foundation', version 11.0.12302001
System Description: Arch Linux

Configured using:
  'configure --with-tree-sitter --with-modules --without-gconf
  PKG_CONFIG_PATH=/home/arch-aug/_opam/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LANG: fr_FR.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   minibuffer-regexp-mode: t
   line-number-mode: t
   indent-tabs-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x
smerge-mode diff vc-git vc-dispatcher cl-loaddefs cl-lib whitespace
diff-mode easy-mmode rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo gtk
x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs)

Memory information:
((conses 16 46026 10928) (symbols 48 6033 0) (strings 32 16223 1757)
  (string-bytes 1 479609) (vectors 16 11733)
  (vector-slots 8 170944 14863) (floats 8 26 21) (intervals 56 231 0)
  (buffers 992 10))

[-- Attachment #2: 0001-Fix-erts-run-test-in-erts-mode.patch --]
[-- Type: text/x-patch, Size: 2409 bytes --]

From 442afd3c365c4b960d168b1166e1dd935bde5580 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Augustin=20Ch=C3=A9neau?= <btuin@mailo.com>
Date: Mon, 2 Oct 2023 21:00:44 +0200
Subject: [PATCH] Fix `erts-run-test' in erts-mode

The previous behaviour depended on the result of `match-beginning' run
from another function, causing an issue if another function called
ert-test--erts-test.
---
 lisp/emacs-lisp/ert.el      |  6 +++---
 lisp/progmodes/erts-mode.el | 12 +++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index d727bc94ec5..c57e7733138 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -2911,13 +2911,13 @@ ert-test-erts-file
                            (cons 'code transform))))
       ;; Find the start of a test.
       (while (re-search-forward "^=-=\n" nil t)
-        (setq gen-specs (ert-test--erts-test gen-specs file))
+        (setq gen-specs (ert-test--erts-test gen-specs file (match-beginning 0)))
         ;; Search to the end of the test.
         (re-search-forward "^=-=-=\n")))))
 
-(defun ert-test--erts-test (gen-specs file)
+(defun ert-test--erts-test (gen-specs file end)
   (let* ((file-buffer (current-buffer))
-         (specs (ert--erts-specifications (match-beginning 0)))
+         (specs (ert--erts-specifications end))
          (name (cdr (assq 'name specs)))
          (start-before (point))
          (end-after (if (re-search-forward "^=-=-=\n" nil t)
diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el
index 8dce93eae7e..b72e1df44ca 100644
--- a/lisp/progmodes/erts-mode.el
+++ b/lisp/progmodes/erts-mode.el
@@ -178,11 +178,13 @@ erts-run-test
   (save-excursion
     (erts-mode--goto-start-of-test)
     (condition-case arg
-        (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")))
-         (buffer-file-name))
+        (let ((end (point)))
+         (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")))
+          (buffer-file-name)
+          end))
       (:success (message "Test successful"))
       (ert-test-failed
        (if (not verbose)
-- 
2.42.0


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

* bug#66312: 30.0.50; erts-run-test always fails
  2023-10-02 19:25 bug#66312: 30.0.50; erts-run-test always fails Augustin Chéneau
@ 2024-05-18 21:52 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-18 21:52 UTC (permalink / raw)
  To: Augustin Chéneau; +Cc: 66312

Augustin Chéneau (BTuin) <btuin@mailo.com> writes:

> Every time I try to use the command `erts-run-test' in erts files (such
> as emacs/test/lisp/progmodes/java-ts-mode-resources/indent.erts), it
> fails with the message "No name for test case".  The culprits lies in
> `ert-test--erts-test' which depends on the result of a regex search run in
> another function (with match-beginning).
>
> It probably works in batch mode (I don't know how to use it), but in
> erts-mode the search is not executed so the function is not run correctly and
> fails.
>
> By the way, is there any resource about running erts files? I looked in
> the ERT manual, but there is only information on writing erts files and
> executing regular ERT files.

If you want to run the tests you mentioned, you should evaluate
'java-ts-mode-tests.el' file (which loads erts resources) and then do
M-x ert RET t RET. Or you can run individual tests using C-c C-c in
erts-mode with the cursor at test.

Best

Jakub






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

end of thread, other threads:[~2024-05-18 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-02 19:25 bug#66312: 30.0.50; erts-run-test always fails Augustin Chéneau
2024-05-18 21:52 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors

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