branch: externals/hyperbole commit 14b25ef2201173f804b3b8fd1dce46c9bf0a3888 Author: Robert Weiner <r...@gnu.org> Commit: Robert Weiner <r...@gnu.org>
Update 2 tests to handle rest of code updates in next commit --- ChangeLog | 7 +++++++ test/hibtypes-tests.el | 15 ++++++++------- test/hy-test-helpers.el | 5 +++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c032754c3b..4a6a975cf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ * hyrolo.el (hyrolo-map-level-1): Fix sorting bug by adding outline-hide-subtree when on last buffer entry so its contents are kept together during hyrolo-sort. +* test/hibtypes-tests.el: (ibtypes::pathname-dot-slash-in-other-folder-test): Update + now that invalid paths trigger the pathname ibtype and throw an error when the + invalid path is resolved with hpath:find. + test/hy-test-helpers.el (hy-test-helpers:action-key-should-call-hpath:find): + Add call to hpath:mswindows-to-posix or under WSL, absolute prefix may not match, + e.g. one path starts with '/mnt/c' and another with '/c'. + 2021-12-26 Bob Weiner <r...@gnu.org> * kotl/kotl-mode.el (kotl-mode:exchange-cells): Signal error if invalid type or value diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el index f27c979395..c5482735a3 100644 --- a/test/hibtypes-tests.el +++ b/test/hibtypes-tests.el @@ -159,18 +159,19 @@ (kill-buffer "tmp"))) (ert-deftest ibtypes::pathname-dot-slash-in-other-folder-test () - "Pathname that starts with ./ only works if in same folder." + "Invalid pathname that starts with ./ triggers an error when resolved." (with-temp-buffer (insert "\"./hypb.el\"") (goto-char 2) - (let ((help-buffer "*Help: Hyperbole Action Key*") - (default-directory (expand-file-name "test" hyperb:dir))) - (hkey-help) - (set-buffer help-buffer) - (should (string-match "no matching context" (buffer-string)))))) + (condition-case err + (action-key) + (error + (progn + (should (equal (car err) 'error)) + (should (string-match "hpath:find" (cadr err)))))))) (ert-deftest ibtypes::pathname-dot-slash-in-same-folder-test () - "Pathname that starts with ./ only works if in same folder." + "Pathname that starts with ./ resolves properly when found in default-directory." (with-temp-buffer (insert "\"./hypb.el\"") (goto-char 2) diff --git a/test/hy-test-helpers.el b/test/hy-test-helpers.el index 844ef0e4e2..49fe8d3c9b 100644 --- a/test/hy-test-helpers.el +++ b/test/hy-test-helpers.el @@ -20,7 +20,7 @@ (eval-when-compile (require 'cl-lib)) (defun hy-test-helpers:consume-input-events () - "Use recusive-edit to consume the events kbd-key generate." + "Use recusive-edit to consume the events kbd-key generates." (run-with-timer 0.1 nil (lambda () (if (< 0 (recursion-depth)) (exit-recursive-edit)))) (recursive-edit)) @@ -36,7 +36,8 @@ (let ((was-called nil)) (cl-letf (((symbol-function 'hpath:find) (lambda (filename) - (setq was-called (should (string= str filename)))))) + (setq filename (hpath:mswindows-to-posix filename) + was-called (should (string= str filename)))))) (action-key) (should was-called))))