lang/emacs-lisp: add test localleader keys for buttercup

This commit is contained in:
Henrik Lissner 2019-07-25 12:56:34 +02:00
parent 7d9e844e35
commit a47351c58f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 28 additions and 1 deletions

View file

@ -101,6 +101,19 @@ if it's callable, `apropos' otherwise."
(bury-buffer buf)
buf)))))
;;;###autoload
(defun +emacs-lisp/buttercup-run-file ()
"Run all buttercup tests in the focused buffer."
(interactive)
(let ((load-path (append (list (doom-path (dir!) "..")
(or (doom-project-root)
default-directory))
load-path)))
(save-selected-window
(eval-buffer)
(buttercup-run))
(message "File executed successfully")))
;;
;;; Hooks

View file

@ -127,7 +127,21 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
(use-package! buttercup
:defer t
:minor ("/test[/-].+\\.el$" . buttercup-minor-mode)
:config (set-yas-minor-mode! 'buttercup-minor-mode))
:preface
;; buttercup.el doesn't define a keymap for `buttercup-minor-mode', as we have
;; to fool its internal `define-minor-mode' call into thinking one exists, so
;; it will associate it with the mode.
(defvar buttercup-minor-mode-map (make-sparse-keymap))
:config
(set-yas-minor-mode! 'buttercup-minor-mode)
(when (featurep 'evil)
(add-hook 'buttercup-minor-mode-hook #'evil-normalize-keymaps))
(map! :map buttercup-minor-mode-map
:localleader
:prefix "t"
"t" #'+emacs-lisp/buttercup-run-file
"a" #'buttercup-run-discover
"s" #'buttercup-run-at-point))
;;