aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2024-02-13 12:27:38 -0800
committerJim Porter2024-02-13 12:27:38 -0800
commit160165e8a97cfa3f3ffd803be373a3b34ed87597 (patch)
tree714a72484f135fc651f709ff62efba70c42cd3cb /test
parent371ccf09fea26892a2fada028d27fb4b596636df (diff)
downloademacs-160165e8a97cfa3f3ffd803be373a3b34ed87597.tar.gz
emacs-160165e8a97cfa3f3ffd803be373a3b34ed87597.zip
; Compute the list of symbols for 'eshell-eval-using-options' once
* lisp/eshell/esh-opt.el (eshell--get-option-symbols): New function... (eshell-eval-using-options): ... use it. (eshell--do-opts, eshell--process-args): Take OPTION-SYMS. * test/lisp/eshell/esh-opt-tests.el (esh-opt-test/process-args): (esh-opt-test/process-args-parse-leading-options-only): (esh-opt-test/process-args-external): Pass OPTION-SYMS in.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/esh-opt-tests.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/lisp/eshell/esh-opt-tests.el b/test/lisp/eshell/esh-opt-tests.el
index 8d6e0c1e426..4e5373e53cd 100644
--- a/test/lisp/eshell/esh-opt-tests.el
+++ b/test/lisp/eshell/esh-opt-tests.el
@@ -29,13 +29,15 @@
29 (eshell--process-args 29 (eshell--process-args
30 "sudo" '("-a") 30 "sudo" '("-a")
31 '((?a "all" nil show-all 31 '((?a "all" nil show-all
32 "do not ignore entries starting with ."))))) 32 "do not ignore entries starting with ."))
33 '(show-all))))
33 (should 34 (should
34 (equal '("root" "world") 35 (equal '("root" "world")
35 (eshell--process-args 36 (eshell--process-args
36 "sudo" '("-u" "root" "world") 37 "sudo" '("-u" "root" "world")
37 '((?u "user" t user 38 '((?u "user" t user
38 "execute a command as another USER")))))) 39 "execute a command as another USER"))
40 '(user)))))
39 41
40(ert-deftest esh-opt-test/process-args-parse-leading-options-only () 42(ert-deftest esh-opt-test/process-args-parse-leading-options-only ()
41 "Test behavior of :parse-leading-options-only in `eshell--process-args'." 43 "Test behavior of :parse-leading-options-only in `eshell--process-args'."
@@ -45,20 +47,23 @@
45 "sudo" '("emerge" "-uDN" "world") 47 "sudo" '("emerge" "-uDN" "world")
46 '((?u "user" t user 48 '((?u "user" t user
47 "execute a command as another USER") 49 "execute a command as another USER")
48 :parse-leading-options-only)))) 50 :parse-leading-options-only)
51 '(user))))
49 (should 52 (should
50 (equal '("root" "emerge" "-uDN" "world") 53 (equal '("root" "emerge" "-uDN" "world")
51 (eshell--process-args 54 (eshell--process-args
52 "sudo" '("-u" "root" "emerge" "-uDN" "world") 55 "sudo" '("-u" "root" "emerge" "-uDN" "world")
53 '((?u "user" t user 56 '((?u "user" t user
54 "execute a command as another USER") 57 "execute a command as another USER")
55 :parse-leading-options-only)))) 58 :parse-leading-options-only)
59 '(user))))
56 (should 60 (should
57 (equal '("DN" "emerge" "world") 61 (equal '("DN" "emerge" "world")
58 (eshell--process-args 62 (eshell--process-args
59 "sudo" '("-u" "root" "emerge" "-uDN" "world") 63 "sudo" '("-u" "root" "emerge" "-uDN" "world")
60 '((?u "user" t user 64 '((?u "user" t user
61 "execute a command as another USER")))))) 65 "execute a command as another USER"))
66 '(user)))))
62 67
63(ert-deftest esh-opt-test/process-args-external () 68(ert-deftest esh-opt-test/process-args-external ()
64 "Test behavior of :external in `eshell--process-args'." 69 "Test behavior of :external in `eshell--process-args'."
@@ -69,7 +74,8 @@
69 "ls" '("/some/path") 74 "ls" '("/some/path")
70 '((?a "all" nil show-all 75 '((?a "all" nil show-all
71 "do not ignore entries starting with .") 76 "do not ignore entries starting with .")
72 :external "ls"))))) 77 :external "ls")
78 '(show-all)))))
73 (cl-letf (((symbol-function 'eshell-search-path) #'identity)) 79 (cl-letf (((symbol-function 'eshell-search-path) #'identity))
74 (should 80 (should
75 (equal '(no-catch eshell-ext-command "ls") 81 (equal '(no-catch eshell-ext-command "ls")
@@ -78,7 +84,8 @@
78 "ls" '("-u" "/some/path") 84 "ls" '("-u" "/some/path")
79 '((?a "all" nil show-all 85 '((?a "all" nil show-all
80 "do not ignore entries starting with .") 86 "do not ignore entries starting with .")
81 :external "ls")) 87 :external "ls")
88 '(show-all))
82 :type 'no-catch)))) 89 :type 'no-catch))))
83 (cl-letf (((symbol-function 'eshell-search-path) #'ignore)) 90 (cl-letf (((symbol-function 'eshell-search-path) #'ignore))
84 (should-error 91 (should-error
@@ -86,7 +93,8 @@
86 "ls" '("-u" "/some/path") 93 "ls" '("-u" "/some/path")
87 '((?a "all" nil show-all 94 '((?a "all" nil show-all
88 "do not ignore entries starting with .") 95 "do not ignore entries starting with .")
89 :external "ls")) 96 :external "ls")
97 '(show-all))
90 :type 'error))) 98 :type 'error)))
91 99
92(ert-deftest esh-opt-test/eval-using-options-short () 100(ert-deftest esh-opt-test/eval-using-options-short ()