Update all unit tests

To meet changes introduced from the straight branch merge.
This commit is contained in:
Henrik Lissner 2019-09-03 00:41:03 -04:00
parent 52b6c51914
commit 059ede53b6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
20 changed files with 728 additions and 426 deletions

View file

@ -1,5 +1,12 @@
;;; core/cli/test.el -*- lexical-binding: t; -*-
(defun doom--emacs-binary ()
(let ((emacs-binary-path (doom-path invocation-directory invocation-name))
(runemacs-binary-path (if IS-WINDOWS (doom-path invocation-directory "runemacs.exe"))))
(if (and runemacs-binary-path (file-exists-p runemacs-binary-path))
runemacs-binary-path
emacs-binary-path)))
(defcli! test (&rest targets)
"Run Doom unit tests."
(let (files error)
@ -14,6 +21,7 @@
(cdr (doom-module-load-path)))))))
(while targets
(let ((target (pop targets)))
;; FIXME Module targets don't work
(cond ((equal target ":core")
(appendq! files (nreverse (doom-glob doom-core-dir "test/test-*.el"))))
((file-directory-p target)
@ -21,14 +29,13 @@
(appendq! files (nreverse (doom-glob target "test/test-*.el"))))
((file-exists-p target)
(push target files)))))
(require 'restart-emacs)
(with-temp-buffer
(setenv "DOOMDIR" (concat doom-core-dir "test/"))
(setenv "DOOMLOCALDIR" (concat doom-local-dir "test/"))
(print! (start "Bootstrapping test environment, if necessary..."))
(if (zerop
(call-process
(restart-emacs--get-emacs-binary)
(doom--emacs-binary)
nil t nil "--batch"
"-l" (concat doom-core-dir "core.el")
"--eval" (prin1-to-string
@ -49,18 +56,20 @@
(with-temp-buffer
(unless
(zerop
(call-process
(restart-emacs--get-emacs-binary)
nil t nil "--batch"
"-l" (concat doom-core-dir "core.el")
"-l" (concat doom-core-dir "test/helpers.el")
"--eval" (prin1-to-string `(doom-initialize 'force))
"-l" "buttercup"
"-l" file
"-f" "buttercup-run"))
(apply #'call-process
(doom--emacs-binary)
nil t nil "--batch"
(append (list
"-l" (concat doom-core-dir "core.el")
"-l" (concat doom-core-dir "test/helpers.el"))
(when (file-in-directory-p file doom-modules-dir)
(list "-f" "doom-initialize-core"))
(list
"-l" file
"-f" "buttercup-run"))))
(setq error t))
(message "%s" (buffer-string)))
(print! (info "Ignoring %s" (relpath file)))))
(if error
(error "A test failed")
(user-error "A test failed")
t)))