branch: externals/hyperbole commit 4e1f1b03e98942511ecb233ba1e9025304c7deb7 Author: Robert Weiner <r...@gnu.org> Commit: Robert Weiner <r...@gnu.org>
Fix tests that failed on Emacs 27.1. --- hpath.el | 3 ++- test/hpath-tests.el | 38 ++++++++++++++++++-------------------- test/hsys-org-tests.el | 4 +++- test/hui-tests.el | 2 +- test/kotl-orgtbl-tests.el | 6 +++--- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/hpath.el b/hpath.el index 90440fcd04..f6b122052f 100644 --- a/hpath.el +++ b/hpath.el @@ -1561,7 +1561,8 @@ in-buffer path will not match." (list start end))))) (defun hpath:substitute-value (path) - "Substitute matching value for Emacs Lisp variables and environment variables in PATH and return PATH." + "Substitute matching value for Emacs Lisp variables and environment variables in PATH and return PATH. +Format of variables must be \"${variable-name}\"." (let ((new-path (hpath:substitute-match-value "\\$@?\{\\([^\}]+\\)@?\}" path diff --git a/test/hpath-tests.el b/test/hpath-tests.el index 24defb1fc3..80532180d6 100644 --- a/test/hpath-tests.el +++ b/test/hpath-tests.el @@ -80,33 +80,31 @@ (hpath:find "-tutorial.el") (should was-called)))) -(ert-deftest hpath:subsitute-value-test () +(ert-deftest hpath:substitute-value-test () "Environment and Lisp variables shall be substituted in a path." - (progn () - (setq hypb:lc-var "lower") - (setq hypb:uc-var "UPPER") - (setenv "HYPB_TEST_ENV" "env") + (progn + (setq hypb:lc-var "lower") + (setq hypb:uc-var "UPPER") + (setenv "HYPB_TEST_ENV" "env") - (should (string= (hpath:substitute-value "/nothing/to/substitute") "/nothing/to/substitute")) + (should (string= (hpath:substitute-value "/nothing/to/substitute") "/nothing/to/substitute")) - (should (string= (hpath:substitute-value "${hypb:lc-var}") hypb:lc-var)) - (should (string= (hpath:substitute-value "${hypb:uc-var}") hypb:uc-var)) - (should (string= (hpath:substitute-value "$HYPB_TEST_ENV") (getenv "HYPB_TEST_ENV"))) - (should (string= (hpath:substitute-value "${HYPB_TEST_ENV}") (getenv "HYPB_TEST_ENV"))) + (should (string= (hpath:substitute-value "${hypb:lc-var}") hypb:lc-var)) + (should (string= (hpath:substitute-value "${hypb:uc-var}") hypb:uc-var)) + (should (string= (hpath:substitute-value "${HYPB_TEST_ENV}") (getenv "HYPB_TEST_ENV"))) - (should (string= (hpath:substitute-value "prefix${hypb:lc-var}suffix") (concat "prefix" hypb:lc-var "suffix"))) - (should (string= (hpath:substitute-value "prefix/$HYPB_TEST_ENV/suffix") (concat "prefix/" (getenv "HYPB_TEST_ENV") "/suffix"))) - (should (string= (hpath:substitute-value "prefix${HYPB_TEST_ENV}suffix") (concat "prefix" (getenv "HYPB_TEST_ENV") "suffix"))) + (should (string= (hpath:substitute-value "prefix${hypb:lc-var}suffix") (concat "prefix" hypb:lc-var "suffix"))) + (should (string= (hpath:substitute-value "prefix/${HYPB_TEST_ENV}/suffix") (concat "prefix/" (getenv "HYPB_TEST_ENV") "/suffix"))) + (should (string= (hpath:substitute-value "prefix${HYPB_TEST_ENV}suffix") (concat "prefix" (getenv "HYPB_TEST_ENV") "suffix"))) - (should (string= (hpath:substitute-value "${hypb:lc-var}${hypb:uc-var}") (concat hypb:lc-var hypb:uc-var))) - (should (string= (hpath:substitute-value "$HYPB_TEST_ENV/$HYPB_TEST_ENV") (concat (getenv "HYPB_TEST_ENV") "/" (getenv "HYPB_TEST_ENV")))) - (should (string= (hpath:substitute-value "${HYPB_TEST_ENV}${HYPB_TEST_ENV}") (concat (getenv "HYPB_TEST_ENV") (getenv "HYPB_TEST_ENV")))) + (should (string= (hpath:substitute-value "${hypb:lc-var}${hypb:uc-var}") (concat hypb:lc-var hypb:uc-var))) + (should (string= (hpath:substitute-value "${HYPB_TEST_ENV}/${HYPB_TEST_ENV}") (concat (getenv "HYPB_TEST_ENV") "/" (getenv "HYPB_TEST_ENV")))) + (should (string= (hpath:substitute-value "${HYPB_TEST_ENV}${HYPB_TEST_ENV}") (concat (getenv "HYPB_TEST_ENV") (getenv "HYPB_TEST_ENV")))) - (should (string= (hpath:substitute-value "prefix${hypb:lc-var}/$HYPB_TEST_ENV/suffix") (concat "prefix" hypb:lc-var "/" (getenv "HYPB_TEST_ENV") "/suffix"))) + (should (string= (hpath:substitute-value "prefix${hypb:lc-var}/${HYPB_TEST_ENV}/suffix") (concat "prefix" hypb:lc-var "/" (getenv "HYPB_TEST_ENV") "/suffix"))) - (should (string= (hpath:substitute-value "$UNDEFINED_IS_NOT_SUBSTITUTED") "$UNDEFINED_IS_NOT_SUBSTITUTED")) - (should (string= (hpath:substitute-value "${UNDEFINED_IS_NOT_SUBSTITUTED}") "${UNDEFINED_IS_NOT_SUBSTITUTED}")) - )) + (should (string= (hpath:substitute-value "$UNDEFINED_IS_NOT_SUBSTITUTED") "$UNDEFINED_IS_NOT_SUBSTITUTED")) + (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." diff --git a/test/hsys-org-tests.el b/test/hsys-org-tests.el index 4b8ef3acad..3a9dfd8217 100644 --- a/test/hsys-org-tests.el +++ b/test/hsys-org-tests.el @@ -30,7 +30,9 @@ (should (not (org-check-for-hidden 'headlines))) (hsys-org-cycle) (should (org-check-for-hidden 'headlines)) - (with-suppressed-warnings ((interactive-only next-line)) (next-line)) + (if (fboundp 'with-suppressed-warnings) + (with-suppressed-warnings ((interactive-only next-line)) (next-line)) + (next-line)) (should (equal (line-number-at-pos) 4)))) (ert-deftest hsys-org:region-with-text-property-value () diff --git a/test/hui-tests.el b/test/hui-tests.el index 63d9010585..951f0a37bb 100644 --- a/test/hui-tests.el +++ b/test/hui-tests.el @@ -129,7 +129,7 @@ Modifying the button but keeping the label creates a dubbel label." (unwind-protect (progn (find-file file) - (should (hact 'kbd-key "C-h h e c label RET RET exec-shell-cmd RET ls SPC /tmp RET y RET")) + (should (hact 'kbd-key "C-h h e c label RET RET exec-shell-cmd RET ls SPC /tmp RET y n C-x C-s")) (hy-test-helpers:consume-input-events) (should (eq (hattr:get (hbut:at-p) 'actype) 'actypes::exec-shell-cmd)) (should (equal (hattr:get (hbut:at-p) 'args) '("ls /tmp" t nil))) diff --git a/test/kotl-orgtbl-tests.el b/test/kotl-orgtbl-tests.el index 3e95516b6a..e8cefe6f3e 100644 --- a/test/kotl-orgtbl-tests.el +++ b/test/kotl-orgtbl-tests.el @@ -26,7 +26,7 @@ (declare-function hy-test-helpers:consume-input-events "hy-test-helpers") (ert-deftest kotl-orgtbl-enabled-uses-kotl-mode-delete-char-outside-of-table () - "kotl-mode:detele-char is used outside of org table." + "kotl-mode:delete-char is used outside of org table." (let ((kotl-file (make-temp-file "hypb" nil ".kotl"))) (unwind-protect (progn @@ -34,7 +34,7 @@ (insert "1") ;; Create an org table and leave point at end of cell - (should (hact 'kbd-key "RET |-| RET")) + (should (hact 'kbd-key "RET |field1|field2| RET")) (hy-test-helpers:consume-input-events) ;; Verify that kotl-mode:delete-char is used outside of the @@ -59,7 +59,7 @@ (should orgtbl-mode) ;; Create an org table - (should (hact 'kbd-key "RET |-| RET")) + (should (hact 'kbd-key "RET |field1|field2| RET")) (hy-test-helpers:consume-input-events) (left-char 1)