1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

; Add another test for 'eshell-batch-script'

* lisp/eshell/em-script.el (eshell-close-target): New function.

* test/lisp/eshell/em-script-tests.el (em-script-test/batch-file): New
test; rename old one to...
(em-script-test/batch-file/shebang): ... this.
This commit is contained in:
Jim Porter 2024-06-09 11:53:29 -07:00
parent 0aed6f5f0d
commit b91b81957c
2 changed files with 16 additions and 0 deletions

View File

@ -137,6 +137,10 @@ Comments begin with `#'."
"Return non-nil to indicate that the display is line-oriented." "Return non-nil to indicate that the display is line-oriented."
t) t)
(cl-defmethod eshell-close-target ((_target eshell-princ-target) _status)
"Close the `princ' function TARGET."
nil)
;;;###autoload ;;;###autoload
(defun eshell-batch-file () (defun eshell-batch-file ()
"Execute an Eshell script as a batch script from the command line. "Execute an Eshell script as a batch script from the command line.

View File

@ -116,6 +116,18 @@
(ert-deftest em-script-test/batch-file () (ert-deftest em-script-test/batch-file ()
"Test running an Eshell script file as a batch script." "Test running an Eshell script file as a batch script."
(skip-unless (not (memq system-type '(windows-nt ms-dos)))) (skip-unless (not (memq system-type '(windows-nt ms-dos))))
(ert-with-temp-file temp-file
:text "echo hi"
(with-temp-buffer
(with-temp-eshell-settings
(call-process (expand-file-name invocation-name invocation-directory)
nil '(t nil) nil
"--batch" "-f" "eshell-batch-file" temp-file))
(should (equal (buffer-string) "hi\n")))))
(ert-deftest em-script-test/batch-file/shebang ()
"Test running an Eshell script file as a batch script via a shebang."
(skip-unless (not (memq system-type '(windows-nt ms-dos))))
(ert-with-temp-file temp-file (ert-with-temp-file temp-file
:text (format :text (format
"#!/usr/bin/env -S %s --batch -f eshell-batch-file\necho hi" "#!/usr/bin/env -S %s --batch -f eshell-batch-file\necho hi"