diff options
| author | Jim Porter | 2024-01-26 10:17:19 -0800 |
|---|---|---|
| committer | Jim Porter | 2024-01-26 10:17:19 -0800 |
| commit | 047607f6e611709f89f6c93ae0e2fc97b25bf18f (patch) | |
| tree | bd8f9d4d810fe627bb0b6f1c0956ae7585806bc2 /test/lisp/eshell/esh-cmd-tests.el | |
| parent | de020255a5cef4349d786fceb19481352c49557b (diff) | |
| download | emacs-047607f6e611709f89f6c93ae0e2fc97b25bf18f.tar.gz emacs-047607f6e611709f89f6c93ae0e2fc97b25bf18f.zip | |
Fix detection of directly-invokable commands in Eshell
I think this regressed partly due to eef32d13da58, so let's add some
regression tests to make sure that doesn't happen again.
* lisp/eshell/em-unix.el (eshell-unix-initialize): Add "compile".
* lisp/eshell/esh-cmd.el (eshell--find-subcommands): Yield the second
element of the subcommand.
(eshell--invoke-command-directly-p): Rename and account for
'eshell-with-copied-handles'.
(eshell-invoke-directly): Rename to...
(eshell-invoke-directly-p): ... this, and use 'pcase' to make the
logic clearer.
* lisp/eshell/esh-mode.el (eshell-send-input): Always queue input if
the process is running; rename some locals to be clearer.
* lisp/eshell/esh-var.el (eshell-var-initialize): Add "env" as a
complex command.
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test--deftest-invoke-directly): New macro.
(no-args, with-args, multiple-cmds, subcmd, complex, complex-subcmd):
New test cases.
Diffstat (limited to 'test/lisp/eshell/esh-cmd-tests.el')
| -rw-r--r-- | test/lisp/eshell/esh-cmd-tests.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el index be31681267b..c37e6d14187 100644 --- a/test/lisp/eshell/esh-cmd-tests.el +++ b/test/lisp/eshell/esh-cmd-tests.el | |||
| @@ -469,6 +469,26 @@ This tests when `eshell-lisp-form-nil-is-failure' is nil." | |||
| 469 | "no")) | 469 | "no")) |
| 470 | 470 | ||
| 471 | 471 | ||
| 472 | ;; Direct invocation | ||
| 473 | |||
| 474 | (defmacro esh-cmd-test--deftest-invoke-directly (name command expected) | ||
| 475 | "FIXME" | ||
| 476 | (declare (indent 2)) | ||
| 477 | `(ert-deftest ,(intern (concat "esh-cmd-test/invoke-directly/" | ||
| 478 | (symbol-name name))) () | ||
| 479 | (with-temp-eshell | ||
| 480 | (should (equal (eshell-invoke-directly | ||
| 481 | (eshell-parse-command ,command nil t)) | ||
| 482 | ,expected))))) | ||
| 483 | |||
| 484 | (esh-cmd-test--deftest-invoke-directly no-args "echo" t) | ||
| 485 | (esh-cmd-test--deftest-invoke-directly with-args "echo hi" t) | ||
| 486 | (esh-cmd-test--deftest-invoke-directly multiple-cmds "echo hi; echo bye" nil) | ||
| 487 | (esh-cmd-test--deftest-invoke-directly subcmd "echo ${echo hi}" t) | ||
| 488 | (esh-cmd-test--deftest-invoke-directly complex "ls ." nil) | ||
| 489 | (esh-cmd-test--deftest-invoke-directly complex-subcmd "echo {ls .}" nil) | ||
| 490 | |||
| 491 | |||
| 472 | ;; Error handling | 492 | ;; Error handling |
| 473 | 493 | ||
| 474 | (ert-deftest esh-cmd-test/throw () | 494 | (ert-deftest esh-cmd-test/throw () |