Add exunit mode modeled after rspec-mode

This commit is contained in:
Justin Smestad 2020-10-22 18:39:59 -06:00
parent adff1aa68d
commit 95ef7f33b1
3 changed files with 42 additions and 11 deletions

View file

@ -13,6 +13,8 @@
- [[#gentoo-linux][Gentoo Linux]]
- [[#opensuse][openSUSE]]
- [[#features][Features]]
- [[#appendix][Appendix]]
- [[#commands][Commands]]
* Description
This module provides support for [[https://elixir-lang.org/][Elixir programming language]] via [[https://github.com/tonini/alchemist.el][alchemist.el]]
@ -60,3 +62,16 @@ sudo zypper install elixir
- Phoenix support
- ~iex~ integration (~:tools eval~)
- Syntax checking (~:checkers syntax~, using [[https://github.com/aaronjensen/flycheck-credo][flycheck-credo]]~)
* Appendix
** Commands
*** exunit-mode
The exunit-mode prefix is =SPC m t=. Here is some examples:
| | | |
| command | key / ex command | description |
|------------------------------------------+------------------+--------------------------------------------------------|
| ~exunit-verify-all~ | =SPC m t a= | Runs exunit on all files |
| ~exunit-rerun~ | =SPC m t r= | Re-runs last exunit command |
| ~exunit-verify~ | =SPC m t v= | Runs exunit on current file |
| ~exunit-verify-single~ | =SPC m t s= | Runs exunit for the item on cursor |
| ~exunit-toggle-file-and-test~ | =SPC m t t= | Switch between implementation and test |
| ~exunit-toggle-file-and-test-other-window~ | =SPC m t T= | Switch between implementation and test in other window |

View file

@ -71,3 +71,18 @@
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))
(remove-hook 'alchemist-mode-hook fn)
(remove-hook 'alchemist-iex-mode-hook fn)))
(use-package! exunit
:hook (elixir-mode . exunit-mode)
:defer t
:config
(map! :after elixir-mode
:localleader
:map elixir-mode-map
:prefix "t"
"a" #'exunit-verify-all
"r" #'exunit-rerun
"v" #'exunit-verify
"T" #'exunit-toggle-file-and-test
"t" #'exunit-toggle-file-and-test-other-window
"s" #'exunit-verify-single))

View file

@ -4,5 +4,6 @@
;; +elixir.el
(package! elixir-mode :pin "01b332495d3f44addeb236428041c4ffa0c2ca3b")
(package! alchemist :pin "6f99367511ae209f8fe2c990779764bbb4ccb6ed")
(package! exunit :pin "c77b0397b80d772c98fcc34c9ab131a8350fbf40")
(when (featurep! :checkers syntax)
(package! flycheck-credo :pin "e88f11ead53805c361ec7706e44c3dfee1daa19f"))