branch: externals/compat commit b93ab4c0e0cb7de245af18c675d4cfe53a3dac0a Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Add test for executable-find --- compat-27.el | 2 +- compat-tests.el | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compat-27.el b/compat-27.el index 12209ce7e7..41686f340a 100644 --- a/compat-27.el +++ b/compat-27.el @@ -445,7 +445,7 @@ the value of the variable `exec-path'." (nreverse path))))) (exec-path))) -(compat-defun executable-find (command &optional remote) ;; <UNTESTED> +(compat-defun executable-find (command &optional remote) ;; <compat-tests:executable-find> "Search for COMMAND in `exec-path' and return the absolute file name. Return nil if COMMAND is not found anywhere in `exec-path'. If REMOTE is non-nil, search on the remote host indicated by diff --git a/compat-tests.el b/compat-tests.el index 4da2e121d9..5d035f5b15 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1232,6 +1232,13 @@ (should-equal t (always 1)) ;; single argument (should-equal t (always 1 2 3 4))) ;; multiple arguments +(ert-deftest executable-find () + (should (member (executable-find "sh") '("/usr/bin/sh" "/bin/sh"))) + (should (member (executable-find "ls") '("/usr/bin/ls" "/bin/ls"))) + ;; TODO These dummy calls are executed locally, test Tramp! + (should (member (compat-call executable-find "sh" t) '("/usr/bin/sh" "/bin/sh"))) + (should (member (compat-call executable-find "ls" t) '("/usr/bin/ls" "/bin/ls")))) + (ert-deftest with-existing-directory () (let ((dir (make-temp-name "/tmp/not-exist-"))) (let ((default-directory dir)) @@ -1244,7 +1251,7 @@ (should-equal (temporary-file-directory) temporary-file-directory) (let ((default-directory "/mnt")) (should-equal (temporary-file-directory) default-directory)) - ;; TODO how can we test tramp? + ;; TODO Implement Tramp test ;;(let ((default-directory "/sudo:/")) ;; (should-equal (temporary-file-directory) temporary-file-directory)) ;;(let ((default-directory "/ssh:does-not-exist:/"))