branch: externals/hyperbole commit 372d32e96b4d105d58d974fa32115c87ea9af2c0 Merge: 4ea5696 288cb87 Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
Merge branch 'master' of hyperbole --- ChangeLog | 6 ++++++ test/hpath-tests.el | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index 17b15de..ce7469b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ * hyperbole.el (hkey-initialize): Add missing C-c prefix binding for hyperbole-mode-map. +2021-12-11 Mats Lidell <ma...@gnu.org> + +* test/hpath-tests.el (hypb-run-shell-test-command): Test helper for + running shell commands. + (hpath:prepend-ls-directory-test): Test for "ls R" listing. + 2021-12-05 Bob Weiner <r...@gnu.org> * hyrolo.el (hyrolo-next-match): Handle case when no prior regexp search. diff --git a/test/hpath-tests.el b/test/hpath-tests.el index d9e1651..24defb1 100644 --- a/test/hpath-tests.el +++ b/test/hpath-tests.el @@ -18,6 +18,11 @@ (require 'ert) (require 'hpath) +(load (expand-file-name "hy-test-helpers" + (file-name-directory (or load-file-name + default-directory)))) +(declare-function hy-test-helpers:action-key-should-call-hpath:find "hy-test-helpers") + (ert-deftest hpath:find-report-lisp-variable-path-name-when-not-exists () "Test that hpath:find expands and returns filename when it is non-existent." (condition-case err @@ -103,5 +108,25 @@ (should (string= (hpath:substitute-value "${UNDEFINED_IS_NOT_SUBSTITUTED}") "${UNDEFINED_IS_NOT_SUBSTITUTED}")) )) +(defun hypb-run-shell-test-command (command buffer) + "Run a shell COMMAND with output to BUFFER and select it." + (shell-command command buffer nil) + (switch-to-buffer buffer) + (shell-mode)) + +(ert-deftest hpath:prepend-ls-directory-test () + "Find file in ls -R listing." + (let ((shell-buffer "*hypb-test-shell-buffer*")) + (unwind-protect + (let ((explicit-shell-file-name "/usr/bin/sh") + (default-directory hyperb:dir)) + (hypb-run-shell-test-command "ls -R" shell-buffer) + (dolist (file '("COPYING" "man/version.texi" "man/hkey-help.txt" "man/im/demo.png")) + (goto-char (point-min)) + (should (search-forward (car (last (split-string file "/"))) nil t)) + (backward-char 5) + (hy-test-helpers:action-key-should-call-hpath:find (expand-file-name file hyperb:dir)))) + (kill-buffer shell-buffer)))) + (provide 'hpath-tests) ;;; hpath-tests.el ends here