This VSCode extension will make it a little easier to write tests in golang by generating the majority of the boiler plate needed for common tests.
To install the extension from VSCode:
- Press
Ctrl + P
in VSCode - Enter the following:
ext install Gauntface.gotest-snippets
Optionally, checkout the extension on the VisualStudio Marketplace here.
- gotest
- Generate a table driven test
- gotest-diff
- Generate a diff statement (i.e. a want/got check)
- gotest-diffopts
- Generate a diff statement with options. This is equivalent to
gotest-diff
except it'll set up the options array.
- Generate a diff statement with options. This is equivalent to
- gotest-main
- Generate a
TestMain
function with areset
function you can use to reset all global variables between tests.
- Generate a
- gotest-errors
- Generate an error comparison.
- gotest-errinject
- Generate an error to inject into test cases (useful for consistency).