Skip to content

Commit

Permalink
Fix eask-test-ert--message breaks tests which trigger minibuffer (#286
Browse files Browse the repository at this point in the history
)
  • Loading branch information
joshbax189 authored Dec 3, 2024
1 parent 93bb1c1 commit a6ac555
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
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

0 comments on commit a6ac555

Please sign in to comment.