branch: externals/hyperbole commit 76f40b52e5f9672a164e845d6827e4239a3bcc81 Author: Mats Lidell <mats.lid...@lidells.se> Commit: GitHub <nore...@github.com>
Add func to run all tests and make some test more robust (#63) * Add func to run all tests and make some test more robust * Use expand-file-name --- Changes | 9 +++++++++ hypb-ert.el | 6 ++++++ test/demo-tests.el | 1 + test/hbut-tests.el | 8 ++++---- test/hibtypes-tests.el | 4 ++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index 6231d30..4e8514e 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,12 @@ +2021-04-11 Mats Lidell <ma...@gnu.org> + +* test/hibtypes-tests.el (ibtypes::ctags-vgrind-test) + (ibtypes::etags-test): Make tests independent of default directory. + +* test/demo-tests.el (demo-manifest-test): Make test more robust. + +* hypb-ert.el (hypb-run-all-tests): Run all hyperbole tests. + 2021-04-07 Mats Lidell <ma...@gnu.org> * test/hypb-tests.el: Rename test file diff --git a/hypb-ert.el b/hypb-ert.el index 45a37a2..0d30cb1 100644 --- a/hypb-ert.el +++ b/hypb-ert.el @@ -42,5 +42,11 @@ (defal hypb-ert-sym 'hypb-run-ert-test-symbol) (defal hypb-ert-sel 'hypb-run-ert-test-selector) +(defun hypb-run-all-tests () + "Run every ert test." + (interactive) + (mapc 'load-file (directory-files (expand-file-name "test" hyperb:dir) t "\\.el$")) + (ert t)) + (provide 'hypb-ert) ;;; hypb-ert.el ends here diff --git a/test/demo-tests.el b/test/demo-tests.el index d552de3..22c83be 100644 --- a/test/demo-tests.el +++ b/test/demo-tests.el @@ -255,6 +255,7 @@ (unwind-protect (progn (find-file (expand-file-name "MANIFEST" hyperb:dir)) + (beginning-of-buffer) (forward-line 1) (should (looking-at "COPYING")) (action-key) diff --git a/test/hbut-tests.el b/test/hbut-tests.el index 41cb6aa..7445dbd 100644 --- a/test/hbut-tests.el +++ b/test/hbut-tests.el @@ -30,7 +30,7 @@ (insert "<defal-path DEMO>") (goto-char 4) (action-key) - (should (string= (concat hyperb:dir "DEMO") buffer-file-name)))) + (should (string= (expand-file-name "DEMO" hyperb:dir) buffer-file-name)))) (progn (kill-buffer "DEMO") (ibtype:delete 'ibtypes::defal-path))) @@ -111,7 +111,7 @@ the button text" (insert "<<<DEMO>>>") (goto-char 4) (action-key) - (should (string= (concat hyperb:dir "DEMO") buffer-file-name))) + (should (string= (expand-file-name "DEMO" hyperb:dir) buffer-file-name))) (progn (kill-buffer "DEMO") (ibtype:delete 'ibtypes::defil-path-it)))) @@ -154,7 +154,7 @@ the button text" (with-temp-buffer (insert "<[emacs]>: \"${hyperb:dir}/DEMO\"") (goto-char 4) - (hy-test-helpers:action-key-should-call-hpath:find (concat hyperb:dir "DEMO")))) + (hy-test-helpers:action-key-should-call-hpath:find (expand-file-name "DEMO" hyperb:dir)))) (ert-deftest hbut-ib-link-to-file-with-label-variants () (cl-loop for ch in '(?: ?- ?=) do @@ -162,7 +162,7 @@ the button text" (with-temp-buffer (insert "<[demo]>" (make-string n ch) " \"${hyperb:dir}/DEMO\"") (goto-char 4) - (hy-test-helpers:action-key-should-call-hpath:find (concat hyperb:dir "DEMO")))))) + (hy-test-helpers:action-key-should-call-hpath:find (expand-file-name "DEMO" hyperb:dir)))))) (ert-deftest hbut-ib-url-with-label () "Should find link but fails with (user-error \"No link found\")" diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el index 4be61b5..498b611 100644 --- a/test/hibtypes-tests.el +++ b/test/hibtypes-tests.el @@ -121,7 +121,7 @@ (insert "hy-test-helpers:consume-input-events hy-test-helpers.el 21\n") (goto-char (point-min)) (forward-char 4) - (let ((default-directory (concat default-directory "test"))) + (let ((default-directory (expand-file-name "test" hyperb:dir))) (ibtypes::ctags) (set-buffer "hy-test-helpers.el") (should (looking-at "(defun hy-test-helpers:consume-input-events")))) @@ -138,7 +138,7 @@ (goto-char (point-min)) (forward-line 2) (forward-char 10) - (let ((default-directory (concat default-directory "test"))) + (let ((default-directory (expand-file-name "test" hyperb:dir))) (ibtypes::etags) (set-buffer "hy-test-helpers.el") (should (looking-at "(defun hy-test-helpers:consume-input-events"))))