Fix doom//run-tests

This commit is contained in:
Henrik Lissner 2018-05-24 21:15:44 +02:00
parent 2a8da07e31
commit b70ed84a33
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -7,18 +7,21 @@ command line args following a double dash (each arg should be in the
If neither is available, run all tests in all enabled modules." If neither is available, run all tests in all enabled modules."
(interactive) (interactive)
(doom//reload-autoloads)
(let (noninteractive) (let (noninteractive)
;; Core libraries aren't fully loaded in a noninteractive session, so we ;; Core libraries aren't fully loaded in a noninteractive session, so we
;; reload it with `noninteractive' set to nil to force them to. ;; reload it with `noninteractive' set to nil to force them to.
(doom-initialize)) (doom-initialize t)
(doom-initialize-modules t))
(condition-case-unless-debug ex (condition-case-unless-debug ex
(let ((target-paths (let* ((doom-modules (doom-module-table))
(target-paths
;; 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 ((stringp (car modules)) ; command line (cond ((stringp (car modules)) ; command line
(save-match-data (save-match-data
(cl-loop for arg in modules (cl-loop for arg in modules
if (string= arg "core") collect doom-core-dir if (string= arg ":core") collect doom-core-dir
else if (string-match-p "/" arg) else if (string-match-p "/" arg)
nconc (cl-loop for dir in doom-modules-dirs nconc (cl-loop for dir in doom-modules-dirs
collect (expand-file-name arg dir)) collect (expand-file-name arg dir))
@ -43,7 +46,7 @@ If neither is available, run all tests in all enabled modules."
(dolist (path target-paths) (dolist (path target-paths)
(let ((test-path (expand-file-name "test/" path))) (let ((test-path (expand-file-name "test/" path)))
(when (file-directory-p test-path) (when (file-directory-p test-path)
(dolist (test-file (reverse (doom-files-under test-path :match "\\.el$"))) (dolist (test-file (reverse (doom-files-in test-path :match "\\.el$" :full t)))
(load test-file nil :noerror))))) (load test-file nil :noerror)))))
;; ... then run them ;; ... then run them
(switch-to-buffer (get-buffer-create "*blank*")) (switch-to-buffer (get-buffer-create "*blank*"))