Reorganize unit-tests and test workflow

+ Moved unit tests out of tests/ and into their respective modules.
+ Rewrite makefile and added these tasks:
  + <MODULE>/<SUBMODULE> -- byte-compile a specific module
  + test:<MODULE>/<SUBMODULE> -- runs tests for a specific module
  + testi -- run tests in an interactive session of Emacs (WIP)
  + run -- opens an Emacs session with this config; useful when it is in
    a non-standard location.
This commit is contained in:
Henrik Lissner 2017-06-14 20:26:17 +02:00
parent cacd188286
commit 9c93c453e8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
22 changed files with 511 additions and 423 deletions

View file

@ -1,10 +1,15 @@
;;; core/autoload/test.el -*- lexical-binding: t; -*-
;;;###autoload
(defmacro def-test-group! (name &rest body)
(declare (indent defun))
(defmacro def-test! (name &rest body)
"Define a namespaced ERT test."
(declare (indent defun) (doc-string 2))
(unless (plist-get body :disabled)
(dolist (form body)
(when (eq (car form) 'ert-deftest)
(setf (cadr form) (intern (format "test-%s-%s" name (symbol-name (cadr form)))))))
`(progn ,@body)))
`(ert-deftest
,(cl-loop with path = (file-relative-name (file-name-sans-extension load-file-name)
doom-emacs-dir)
for (rep . with) in '(("/test/" . "/") ("/" . ":"))
do (setq path (replace-regexp-in-string rep with path t t))
finally return (intern (format "%s::%s" path name))) ()
()
,@body)))