GoTests-Emacs
is a package for Emacs for automatically generating table driven tests. It uses gotests
to generate missing tests based on its target source files' function and method signatures. Any new dependencies in the test files are automatically imported.
Prequisite: Use go get
to install and update the gotests
tool:
$ go get -u github.com/cweill/gotests/...
Next, copy GoTests-Emacs in your .emacs directory
cd ~/.emacs.d
wget https://raw.githubusercontent.com/damienlevin/GoTests-Emacs/master/gotests.el
In your .emacs add the following:
;; gotests
(add-to-list 'load-path "~/.emacs.d/")
(require 'gotests)
Select some functions and run M-x gotests-region
. This appends missing tests to an existing test file, or creates a new test file with them. To generate all missing tests use M-x gotests
GoTests-Emacs
is released under the Apache 2.0 License.