1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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'.
This commit is contained in:
Jim Porter 2022-08-14 13:44:04 -07:00
parent 07b8fb197a
commit c1f1be4b73
7 changed files with 254 additions and 273 deletions

View file

@ -37,22 +37,22 @@
(ert-deftest em-dirs-test/pwd-var ()
"Test using the $PWD variable."
(let ((default-directory "/some/path"))
(should (equal (eshell-test-command-result "echo $PWD")
(expand-file-name default-directory)))))
(eshell-command-result-equal "echo $PWD"
(expand-file-name default-directory))))
(ert-deftest em-dirs-test/pwd-var-indices ()
"Test using the $PWD variable with indices."
(let ((default-directory "/some/path/here"))
(should (equal (eshell-test-command-result "echo $PWD[/ 1]")
"some"))
(should (equal (eshell-test-command-result "echo $PWD[/ 1 3]")
'("some" "here")))))
(eshell-command-result-equal "echo $PWD[/ 1]"
"some")
(eshell-command-result-equal "echo $PWD[/ 1 3]"
'("some" "here"))))
(ert-deftest em-dirs-test/short-pwd-var ()
"Test using the $+ (current directory) variable."
(let ((default-directory "/some/path"))
(should (equal (eshell-test-command-result "echo $+")
(expand-file-name default-directory)))))
(eshell-command-result-equal "echo $+"
(expand-file-name default-directory))))
(ert-deftest em-dirs-test/oldpwd-var ()
"Test using the $OLDPWD variable."