Open dogsleg opened 1 year ago
The failing test does
(mock (ring-insert * *))
and in Emacs 29, ring-insert
is not called anymore.
dumb-jump-goto-file-line
has the following bit at the start:
(if (fboundp 'xref-push-marker-stack)
(xref-push-marker-stack)
(ring-insert find-tag-marker-ring (point-marker)))
In recent Emacs versions, xref-push-marker-stack
is called. Thus, the test essentially checks the implementation of that function.
xref-push-marker-stack
looks like this in Emacs 28:
(defun xref-push-marker-stack (&optional m)
"Add point M (defaults to `point-marker') to the marker stack."
(ring-insert xref--marker-ring (or m (point-marker))))
In Emacs 29, it's
(defun xref-push-marker-stack (&optional m)
"Add point M (defaults to `point-marker') to the marker stack.
Erase the stack slots following this one."
(xref--push-backward (or m (point-marker)))
(let ((history (xref--get-history)))
(dolist (mk (cdr history))
(set-marker mk nil nil))
(setcdr history nil)))
and
(defun xref--push-backward (m)
"Push marker M onto the backward history stack."
(let ((history (xref--get-history)))
(unless (equal m (caar history))
(push m (car history)))))
Long story short: ring-insert
is not called anymore in Emacs 29. The test is faulty.
We could fix the issue like this:
(ert-deftest dumb-jump-goto-file-line-test ()
(let ((js-file (f-join test-data-dir-proj1 "src" "js" "fake.js")))
(with-mock
(when (version< emacs-version "29")
(mock (ring-insert * *)))
(dumb-jump-goto-file-line js-file 3 0)
(should (string= (buffer-file-name) js-file))
(should (= (line-number-at-pos) 3)))))
or turn the mock
into a stub
or remove that line alltogether.
cc @jacktasia who added this quite some time ago. I'm sure you remember as if you added this yesterday... ;) but is the mock
call supposed to prevent side-effects or can it be removed? Or should it be replaced with something else for Emacs 29?
@jobor Honestly I can't really remember, but I think the last example where you sniff the emacs-version is necessary since we definitely support older versions than that
Hi,
Thanks for your work on dumb-jump.
I'm getting the following error when run against GNU Emacs 29.1 from the Debian unstable archive:
All other tests are fine.