Fix doom//run-tests

This commit is contained in:
Henrik Lissner 2018-02-17 22:17:50 -05:00
parent e770d5ccf2
commit cf4420e903
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -15,10 +15,21 @@ If neither is available, run all tests in all enabled modules."
;; Convert targets (either from MODULES or `argv') into a list of ;; Convert targets (either from MODULES or `argv') into a list of
;; string paths, pointing to the root directory of modules ;; string paths, pointing to the root directory of modules
(cond ((string= (car argv) "--") ; command line (cond ((string= (car argv) "--") ; command line
(cl-loop for arg in (cdr argv) (save-match-data
if (equal arg "core") collect doom-core-dir (cl-loop for arg in (cdr argv)
else collect (expand-file-name arg) if (equal arg "core") collect doom-core-dir
finally do (setq argv nil))) else if (string-match-p "/" arg)
nconc (cl-loop for dir in doom-modules-dirs
collect (expand-file-name arg dir))
else
nconc (cl-loop for dir in doom-modules-dirs
for path = (expand-file-name arg dir)
if (file-directory-p path)
nconc
(cl-remove-if-not
#'file-directory-p
(directory-files path t "^[^.]" t)))
finally do (setq argv nil))))
(modules ; cons-cells given to MODULES (modules ; cons-cells given to MODULES
(cl-loop for (module . submodule) in modules (cl-loop for (module . submodule) in modules
@ -31,9 +42,10 @@ If neither is available, run all tests in all enabled modules."
(append (list doom-core-dir) (doom-module-paths))))))) (append (list doom-core-dir) (doom-module-paths)))))))
;; Load all the unit test files... ;; Load all the unit test files...
(dolist (path target-paths) (dolist (path target-paths)
(when (file-directory-p (expand-file-name "test/" path)) (let ((test-path (expand-file-name "test/" path)))
(dolist (test-file (reverse (doom-packages--files path "\\.el$"))) (when (file-directory-p test-path)
(load test-file nil :nomessage)))) (dolist (test-file (reverse (doom-packages--files test-path "\\.el$")))
(load test-file nil :noerror)))))
;; ... then run them ;; ... then run them
(if noninteractive (if noninteractive
(ert-run-tests-batch-and-exit) (ert-run-tests-batch-and-exit)