diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-08-14 13:44:04 -0700 |
---|---|---|
committer | Jim Porter <jporterbugs@gmail.com> | 2022-08-15 20:40:27 -0700 |
commit | c1f1be4b73072440518f02356998cf58ba127ebd (patch) | |
tree | c56338d1c699bb6ca1cbdf39a13fd939f9d0ff3a /test/lisp/eshell/eshell-tests-helpers.el | |
parent | 07b8fb197a3057a3419be0335236547e4d7a326b (diff) | |
download | emacs-c1f1be4b73072440518f02356998cf58ba127ebd.tar.gz emacs-c1f1be4b73072440518f02356998cf58ba127ebd.tar.bz2 emacs-c1f1be4b73072440518f02356998cf58ba127ebd.zip |
Add 'eshell-command-result-equal' with an ERT explainer
* test/lisp/eshell/eshell-tests-helpers.el
(eshell-command-result--equal, eshell-command-result--equal-explainer)
(eshell-command-result-equal): New functions.
* test/lisp/eshell/em-basic-tests.el
* test/lisp/eshell/em-dirs-tests.el
* test/lisp/eshell/esh-cmd-tests.el
* test/lisp/eshell/esh-proc-tests.el
* test/lisp/eshell/esh-var-tests.el
* test/lisp/eshell/eshell-tests.el: Use 'eshell-command-result-equal'.
Diffstat (limited to 'test/lisp/eshell/eshell-tests-helpers.el')
-rw-r--r-- | test/lisp/eshell/eshell-tests-helpers.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/eshell-tests-helpers.el index 778087bd755..8f0f993447f 100644 --- a/test/lisp/eshell/eshell-tests-helpers.el +++ b/test/lisp/eshell/eshell-tests-helpers.el @@ -104,6 +104,27 @@ After inserting, call FUNC. If FUNC is nil, instead call (let ((eshell-history-file-name nil)) (eshell-command-result command)))) +(defun eshell-command-result--equal (_command actual expected) + "Compare the ACTUAL result of a COMMAND with its EXPECTED value." + (equal actual expected)) + +(defun eshell-command-result--equal-explainer (command actual expected) + "Explain the result of `eshell-command-result--equal'." + `(nonequal-result + (command ,command) + (result ,actual) + (expected ,expected))) + +(put 'eshell-command-result--equal 'ert-explainer + #'eshell-command-result--equal-explainer) + +(defun eshell-command-result-equal (command result) + "Execute COMMAND non-interactively and compare it to RESULT." + (should (eshell-command-result--equal + command + (eshell-test-command-result command) + result))) + (provide 'eshell-tests-helpers) ;;; eshell-tests-helpers.el ends here |