Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a different template for test files #1318

Merged
merged 1 commit into from
Jun 6, 2017

Conversation

bhcleek
Copy link
Collaborator

@bhcleek bhcleek commented Jun 4, 2017

Use a template more appropriate for test files than templates/hello_world.go
when creating a test file in a directory with no Go files present. A new
option, g:go_template_test_file, allows users to specify their own template to
use.

Fixes #1216

import "testing"

func TestHelloWorld(t *testing.T) {
t.Fatal("not implemented")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be commented out by default. It's better to give people a clean pkg instead of a test that's fails. Could you comment this out? The function body should be like:

// t.Fatal("not implemented")

doc/vim-go.txt Outdated
default the `hello_world_test.go` file is used.
>
let g:go_template_test_file = "hello_world_test.go"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the < character is missing here

doc/vim-go.txt Outdated
with a Go code template. By default the template under
`templates/hello_world.go` is used. This can be changed with the
|'g:go_template_file'| setting.
with a Go code template. By default, the templates under `templates` are used.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think under templates folder are used ... is better. People might not know that we have a templates folder.

@fatih
Copy link
Owner

fatih commented Jun 5, 2017

Thanks @bhcleek. A couple of improvements, once you fix them this is good to go

Use a template more appropriate for test files than templates/hello_world.go
when creating a test file in a directory with no Go files present. A new
option, g:go_template_test_file, allows users to specify their own template to
use.
@bhcleek
Copy link
Collaborator Author

bhcleek commented Jun 6, 2017

PTAL

@fatih fatih merged commit a4b64e2 into fatih:master Jun 6, 2017
@fatih
Copy link
Owner

fatih commented Jun 6, 2017

Thanks @bhcleek 👍

@bhcleek bhcleek deleted the feature-test-template branch October 16, 2017 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants