branch: elpa/popup commit 4212a36f3e16094457d62c90c5df0ff5e37beec5 Author: Takafumi Arakaki <aka....@gmail.com> Commit: Takafumi Arakaki <aka....@gmail.com>
Add tests/run-test.el --- tests/run-test.el | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/run-test.el b/tests/run-test.el new file mode 100644 index 0000000..4cb8022 --- /dev/null +++ b/tests/run-test.el @@ -0,0 +1,42 @@ +;; Usage: +;; +;; emacs -Q -l tests/run-test.el # interactive mode +;; emacs -batch -Q -l tests/run-test.el # batch mode + + +;; Utils +(defun popup-test-join-path (path &rest rest) + "Join a list of PATHS with appropriate separator (such as /). + +\(fn &rest paths)" + (if rest + (concat (file-name-as-directory path) (apply 'popup-test-join-path rest)) + path)) + +(defvar popup-test-dir (file-name-directory load-file-name)) +(defvar popup-root-dir (concat popup-test-dir "..")) + + +;; Setup `load-path' +(mapc (lambda (p) (add-to-list 'load-path p)) + (list popup-test-dir + popup-root-dir)) + + +;; Use ERT from github when this Emacs does not have it +(unless (locate-library "ert") + (add-to-list + 'load-path + (popup-test-join-path popup-root-dir "lib" "ert" "lisp" "emacs-lisp")) + (require 'ert-batch) + (require 'ert-ui)) + + +;; Load tests +(load "popup-test") + + +;; Run tests +(if noninteractive + (ert-run-tests-batch-and-exit) + (ert t))