Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix eask-test-ert--message breaks tests which trigger minibuffer #286

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lisp/test/ert.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Arguments FNC and ARGS are used for advice `:around'."
(if eask-test-ert--message-loop (apply fnc args)
(let ((eask-test-ert--message-loop t))
(cond
;; (message nil) is used to clear the minibuffer
;; However, format requires the first argument to be a format string
((null (car args))
(apply fnc args))
((string-match-p "^[ ]+FAILED " (apply #'format args))
(eask-msg (ansi-red (apply #'format args))))
((string-match-p "^[ ]+SKIPPED " (apply #'format args))
Expand Down
4 changes: 4 additions & 0 deletions test/commands/test/ert/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ echo "Test command 'ert'..."
cd $(dirname "$0")

eask test ert ./test/*.el

# regression
echo "Test ert: nil message"
eask test ert ./test-nil-message/*.el
29 changes: 29 additions & 0 deletions test/commands/test/ert/test-nil-message/ert-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
;;; ert-test.el --- Test the command ert -*- lexical-binding: t; -*-

;; Copyright (C) 2024 the Eask authors.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; Tests for the command ert

;;; Code:

(require 'ert)
(require 'debug)

(ert-deftest ert-test-1 ()
(should-not (message nil)))
;;; ert-test.el ends here
2 changes: 0 additions & 2 deletions test/commands/test/ert/test/ert-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@

(ert-deftest ert-test-1 ()
(should (= 1 1)))

(provide 'ert-test)
;;; ert-test.el ends here
Loading