Merge pull request #4139 from jsmestad/add-exunit-to-elixir

Add exunit mode for Elixir
This commit is contained in:
Henrik Lissner 2020-11-27 22:44:22 -05:00 committed by GitHub
commit 8788d69a54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 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]]
@ -25,6 +27,7 @@ or [[https://github.com/elixir-lsp/elixir-ls/][elixir-ls]].
+ [[https://github.com/elixir-editors/emacs-elixir][elixir-mode]]
+ [[https://github.com/tonini/alchemist.el][alchemist.el]]
+ [[https://github.com/aaronjensen/flycheck-credo][flycheck-credo]]
+ [[https://github.com/ananthakumaran/exunit.el][exunit]]
* Prerequisites
You should have Elixir installed, for example, via your distribution's package
@ -60,3 +63,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,17 @@
(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)
:init
(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"))