From 5fb9afef1e2687f1d30276fb33202112f05926c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vegard=20=C3=98ye?= Date: Thu, 16 Jun 2011 15:03:45 +0200 Subject: Add TAG variable to "make emacs" and "make terminal" This makes it possible to specify up-front which tests to run inside an instance of Emacs. --- Makefile | 4 ++-- evil-tests.el | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e142225..af585e1 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ tests: compile-batch emacs: clean $(EMACS) -Q -L . -l evil-tests.el --eval "(evil-mode 1)" \ --eval "(if (y-or-n-p-with-timeout \"Run tests? \" 2 t) \ -(evil-tests-run t) \ +(evil-tests-run '(${TAG}) t) \ (message \"You can run the tests at any time with \`M-x evil-tests-run\'\"))" & # Load Evil in a terminal Emacs and run all tests. @@ -48,7 +48,7 @@ term: terminal terminal: clean $(EMACS) -nw -Q -L . -l evil-tests.el --eval "(evil-mode 1)" \ --eval "(if (y-or-n-p-with-timeout \"Run tests? \" 2 t) \ -(evil-tests-run t) \ +(evil-tests-run '(${TAG}) t) \ (message \"You can run the tests at any time with \`M-x evil-tests-run\'\"))" # Re-indent all Evil code. diff --git a/evil-tests.el b/evil-tests.el index 6069a8b..7122caf 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -15,19 +15,19 @@ (defvar evil-tests-run nil "*Run Evil tests.") -(defun evil-tests-run (&optional tests) +(defun evil-tests-run (&optional tests interactive) "Run Evil tests." - (interactive '(t)) - (if (not (listp tests)) - (ert-run-tests-interactively t) - (ert-run-tests-batch-and-exit - (or (null tests) - `(or ,@(mapcar (lambda (test) - (or (null test) - (and (memq test '(evil t)) t) - `(or (tag ,test) - ,(format "^%s$" test)))) - tests)))))) + (interactive '(nil t)) + (setq tests (or (null tests) + `(or ,@(mapcar (lambda (test) + (or (null test) + (and (memq test '(evil t)) t) + `(or (tag ,test) + ,(format "^%s$" test)))) + tests)))) + (if interactive + (ert-run-tests-interactively tests) + (ert-run-tests-batch-and-exit tests))) (defmacro evil-test-buffer (&rest body) "Execute BODY in a temporary buffer. -- cgit v1.0