GoUnit-Sublime
makes writing better Go tests easy. It is an IDE plugin for Sublime Text 3 that uses gounit
to generate table driven tests from selected function and method signatures. Any new dependencies in the test files are automatically imported.
Prequisite: Use go get
to install and update the gounit
tool:
$ go get -u github.com/hexdigest/gounit/...
Next, install the GoUnit-Sublime
plugin:
With Package Control:
- Run the
Package Control: Install Package
command - Find and install
GoUnit
- Restart Sublime Text (if required)
Manually:
- Clone this repo into your Packages folder
- Restart Sublime Text (if required)
Finally, open Preferences > Package Settings > GoUnit > Settings - User
. In the newly created file, set your $GOPATH
:
// GoUnit.sublime-settings
{
// Add your GOPATH here.
"GOPATH": "/absolute/go/path/"
}
Select some functions, right-click, and select Generate Go tests
. This appends missing tests to an existing test file, or creates a new test file with them.
GoUnit-Sublime
is released under the Apache 2.0 License.