* bug#62152: 29.0.60; `erts-run-test' does not properly set match data for `ert-test--erts-test'
@ 2023-03-12 17:31 Troy Brown
0 siblings, 0 replies; only message in thread
From: Troy Brown @ 2023-03-12 17:31 UTC (permalink / raw)
To: 62152
`ert-test--erts-test' is expecting match data to exist (i.e., set by the
caller) for the beginning of the test. This is used to locate the test
specification data (e.g., 'Name'). However, when this function is
invoked via `erts-run-test', it appears this match data (established by
the call to `erts-mode--goto-start-of-test') is overwritten by the call
to `erts-mode--preceding-spec' to locate "Point-Char". In this
situation, if "Point-Char" exists in the test specification and appears
prior to "Name" in the test specification, the "Name" specification will
not be able to be located (due to the expected match location having
been moved higher in the buffer). As a result a "No name for test case"
error will be raised.
Here is an ERTS test which can be used to reproduce this problem.
Pressing C-c C-c when in `erts-mode' with the following will exhibit the
problem.
Code:
(lambda ()
(fundamental-mode)
(newline))
Point-Char: |
Name: Simple Test
=-=
Hi| there
=-=
Hi
| there
=-=-=
This particular issue can be fixed by wrapping the call to
`erts-mode--preceding-spec` with `save-match-data', but it might be even
better to incorporate that into `erts-mode--preceding-spec' itself.
(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")))
+ (cons 'point-char
+ (save-match-data
+ (erts-mode--preceding-spec "Point-Char"))))
(buffer-file-name))
(:success (message "Test successful"))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-12 17:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-12 17:31 bug#62152: 29.0.60; `erts-run-test' does not properly set match data for `ert-test--erts-test' Troy Brown
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.