Skip to content

Commit

Permalink
Add a workaround for ert-runner to work with Emacs > 26
Browse files Browse the repository at this point in the history
Failed tests can't print backtrace on Emacs > 26 because
`ert--print-backtrace' has been removed in latest Emacs versions.

For more see:

- emacs-mirror/emacs@e09120d
- rejeep/ert-runner.el#49
  • Loading branch information
sergeyklay committed Mar 16, 2020
1 parent 5ee9ba3 commit a5079bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/test-helper.el
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
;; Make sure the exact Emacs version can be found in the build output
(message "Running tests on Emacs %s" emacs-version)

;; `ert--print-backtrace' has been removed in GNU Emacs > 26.
;; See URL `https://github.com/emacs-mirror/emacs/commit/e09120d'.
(when (> emacs-major-version 26)
(defalias 'ert--print-backtrace 'backtrace-to-string))

;; The test fixtures assume an indentation width of 4, so we need to set that
;; up for the tests.
(setq-default default-tab-width 4
Expand Down Expand Up @@ -79,7 +84,7 @@ and the test succeeds if the result did not change."
(zephir-test-with-temp-buffer
code
(indent-region (point-min) (point-max))
(should (string= (buffer-string) code))))
(should (string-equal (buffer-string) code))))

(when (s-contains? "--win" (getenv "ERT_RUNNER_ARGS"))
(defun ert-runner/run-tests-batch-and-exit (selector)
Expand Down

0 comments on commit a5079bc

Please sign in to comment.