summaryrefslogtreecommitdiff
path: root/test/lisp/eshell/eshell-tests-helpers.el
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-09-24 18:13:03 -0700
committerJim Porter <jporterbugs@gmail.com>2022-10-17 18:48:52 -0700
commit2c82530f475c71d90284b2b90980475f73f16a8b (patch)
treec852f179aa715a090c26dadd6ecb2b242f8bee9e /test/lisp/eshell/eshell-tests-helpers.el
parent3cc356abfef8294abcb91dc421e3c63a561a11b4 (diff)
downloademacs-2c82530f475c71d90284b2b90980475f73f16a8b.tar.gz
emacs-2c82530f475c71d90284b2b90980475f73f16a8b.tar.bz2
emacs-2c82530f475c71d90284b2b90980475f73f16a8b.zip
; Allow ignoring errors when calling 'eshell-match-command-output'
* test/lisp/eshell/eshell-tests-helpers.el (eshell-match-command-output): New argument IGNORE-ERRORS. * test/lisp/eshell/esh-var-tests.el (esh-var-test/last-status-var-lisp-command) (esh-var-test/last-status-var-lisp-form) (esh-var-test/last-status-var-lisp-form-2): Ignore errors when calling 'eshell-match-command-output'.
Diffstat (limited to 'test/lisp/eshell/eshell-tests-helpers.el')
-rw-r--r--test/lisp/eshell/eshell-tests-helpers.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/eshell-tests-helpers.el
index 73abfcbb557..e713e162ad0 100644
--- a/test/lisp/eshell/eshell-tests-helpers.el
+++ b/test/lisp/eshell/eshell-tests-helpers.el
@@ -100,9 +100,16 @@ After inserting, call FUNC. If FUNC is nil, instead call
(put 'eshell-match-output 'ert-explainer #'eshell-match-output--explainer)
-(defun eshell-match-command-output (command regexp &optional func)
- "Insert a COMMAND at the end of the buffer and match the output with REGEXP."
- (eshell-insert-command command func)
+(defun eshell-match-command-output (command regexp &optional func
+ ignore-errors)
+ "Insert a COMMAND at the end of the buffer and match the output with REGEXP.
+FUNC is the function to call after inserting the text (see
+`eshell-insert-command').
+
+If IGNORE-ERRORS is non-nil, ignore any errors signaled when
+inserting the command."
+ (let ((debug-on-error (and (not ignore-errors) debug-on-error)))
+ (eshell-insert-command command func))
(eshell-wait-for-subprocess)
(should (eshell-match-output regexp)))