summaryrefslogtreecommitdiff
path: root/test/lisp/eshell/esh-opt-tests.el
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-01-24 21:08:50 -0800
committerLars Ingebrigtsen <larsi@gnus.org>2022-01-25 13:28:48 +0100
commit44ffd6a825300fec5e492805bb105d2c8c3d0c1c (patch)
tree8795aa3284e7fd1f51ce4a13d92484d2350092bf /test/lisp/eshell/esh-opt-tests.el
parentdea24a0f7d4ae42fae912dd724a770678054989a (diff)
downloademacs-44ffd6a825300fec5e492805bb105d2c8c3d0c1c.tar.gz
Treat "-" as a positional arg in 'eshell-eval-using-options'
* lisp/eshell/esh-opt.el (eshell--process-args): Treat "-" as a positional arg. * lisp/eshell/em-tramp.el (eshell/su): Simplify checking for "-". * test/lisp/eshell/esh-opt-tests.el (esh-opt-test/eval-using-options-stdin): New test.
Diffstat (limited to 'test/lisp/eshell/esh-opt-tests.el')
-rw-r--r--test/lisp/eshell/esh-opt-tests.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-opt-tests.el b/test/lisp/eshell/esh-opt-tests.el
index 4331c02ff5b..5b30de414a3 100644
--- a/test/lisp/eshell/esh-opt-tests.el
+++ b/test/lisp/eshell/esh-opt-tests.el
@@ -182,6 +182,27 @@
(should (equal ignore-pattern "*.txt"))
(should (equal args '("/some/path")))))
+(ert-deftest esh-opt-test/eval-using-options-stdin ()
+ "Test that \"-\" is a positional arg in `eshell-eval-using-options'."
+ (eshell-eval-using-options
+ "cat" '("-")
+ '((?A "show-all" nil show-all
+ "show all characters"))
+ (should (eq show-all nil))
+ (should (equal args '("-"))))
+ (eshell-eval-using-options
+ "cat" '("-A" "-")
+ '((?A "show-all" nil show-all
+ "show all characters"))
+ (should (eq show-all t))
+ (should (equal args '("-"))))
+ (eshell-eval-using-options
+ "cat" '("-" "-A")
+ '((?A "show-all" nil show-all
+ "show all characters"))
+ (should (eq show-all t))
+ (should (equal args '("-")))))
+
(ert-deftest esh-opt-test/eval-using-options-terminate-options ()
"Test that \"--\" terminates options in `eshell-eval-using-options'."
(eshell-eval-using-options