File extension test.go in "Go for Visual Studio Code"

Viewed 32

I have installed the extension named "Go for Visual Studio Code" v0.35.2 Rich Go language support for Visual Studio Code.

The extension is working properly on files named .go

On files named ...test.go it does not do anything. Where can I change this so that my test.go files are also affected by the extension?

1 Answers

You can have a look at the tutorial for guidance.

If you have a file foo.go that you want to test, create a foo_test.go in the same package with your tests inside.

Start your test functions with Test and pass them the *testing.T parameter.

Example:

TestHello(t *testing.T) {
   // call your actuel hello function and make your assertions below
}
Related