diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-07-03 20:05:29 -0700 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-07-12 15:10:54 +0200 |
commit | e51ae63ec28c46f37436f649d6421859c1ad0077 (patch) | |
tree | d78227a05f09e78cd62bb7a5a836a954cd1ea7a7 /test/lisp/eshell/esh-var-tests.el | |
parent | f62e1f39be4f7da2c78d884db6ecb68a9f5b1982 (diff) | |
download | emacs-e51ae63ec28c46f37436f649d6421859c1ad0077.tar.gz emacs-e51ae63ec28c46f37436f649d6421859c1ad0077.tar.bz2 emacs-e51ae63ec28c46f37436f649d6421859c1ad0077.zip |
Improve tests/organization for built-in variables
* lisp/eshell/em-dirs.el (eshell-inside-emacs)
(eshell-dirs-initialize): Move 'INSIDE_EMACS' from here...
* lisp/eshell/esh-var.el (eshell-inside-emacs)
(eshell-variable-aliases-alist): ... to here, and improve doc string.
* test/lisp/eshell/eshell-tests.el (eshell-test/inside-emacs-var):
Move from here...
* test/lisp/eshell/esh-var-tests.el (esh-var-test/inside-emacs-var):
... to here.
(esh-var-test/last-arg-var-indices)
(esh-var-test/last-arg-var-split-indices): New tests.
* test/lisp/eshell/em-alias-tests.el:
* test/lisp/eshell/em-dirs-tests.el:
* test/lisp/eshell-em-script-tests.el: New files.
* doc/misc/eshell.texi (Built-ins): Fix 'cd' documentation; it works
with the directory ring, not the directory stack. Move built-in
variables documentation from here...
(Variables): ... to here, and add documentation for missing built-in
variables.
Diffstat (limited to 'test/lisp/eshell/esh-var-tests.el')
-rw-r--r-- | test/lisp/eshell/esh-var-tests.el | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/test/lisp/eshell/esh-var-tests.el b/test/lisp/eshell/esh-var-tests.el index 3180fe7a5fc..955190aee0b 100644 --- a/test/lisp/eshell/esh-var-tests.el +++ b/test/lisp/eshell/esh-var-tests.el @@ -487,6 +487,13 @@ inside double-quotes" (should (equal (eshell-test-command-result "echo $COLUMNS") (window-body-width nil 'remap)))) +(ert-deftest esh-var-test/inside-emacs-var () + "Test presence of \"INSIDE_EMACS\" in subprocesses" + (with-temp-eshell + (eshell-command-result-p "env" + (format "INSIDE_EMACS=%s,eshell" + emacs-version)))) + (ert-deftest esh-var-test/last-result-var () "Test using the \"last result\" ($$) variable" (with-temp-eshell @@ -497,12 +504,26 @@ inside double-quotes" "Test using the \"last result\" ($$) variable twice" (with-temp-eshell (eshell-command-result-p "+ 1 2; + $$ $$" - "3\n6\n"))) + "3\n6\n"))) (ert-deftest esh-var-test/last-arg-var () "Test using the \"last arg\" ($_) variable" (with-temp-eshell (eshell-command-result-p "+ 1 2; + $_ 4" - "3\n6\n"))) + "3\n6\n"))) + +(ert-deftest esh-var-test/last-arg-var-indices () + "Test using the \"last arg\" ($_) variable with indices" + (with-temp-eshell + (eshell-command-result-p "+ 1 2; + $_[0] 4" + "3\n5\n") + (eshell-command-result-p "+ 1 2; + $_[1] 4" + "3\n6\n"))) + +(ert-deftest esh-var-test/last-arg-var-split-indices () + "Test using the \"last arg\" ($_) variable with split indices" + (with-temp-eshell + (eshell-command-result-p "concat 01:02 03:04; echo $_[0][: 1]" + "01:0203:04\n2\n"))) ;; esh-var-tests.el ends here |