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

Add marker interfaces for SetUpTest and TearDownTest methods #118

Open
rillig opened this issue Nov 10, 2019 · 0 comments
Open

Add marker interfaces for SetUpTest and TearDownTest methods #118

rillig opened this issue Nov 10, 2019 · 0 comments

Comments

@rillig
Copy link

rillig commented Nov 10, 2019

Right now, when I add a SetUpTest method to my test suite, JetBrains GoLand reports the parameter as unused, as it doesn't know about these test fixtures.

One way to fix this would be to teach GoLand the API of check.v1.

Another way would be to add the following marker interfaces to check.v1:

type SetUpFixture interface {
	SetUpTest(*check.C)
}
type TearDownFixture interface {
	TearDownTest(*check.C)
}

When this is done, GoLand sees that my SetUpTest method implements this interface, and it no longer complains about the seemingly unused parameter. My guess is that other IDEs behave similar. This would also mean that my SetUpTest method would be marked as implementing this interface, therefore it would be a just a single click to the documentation of the test fixtures:

image

The gutter icons give me a clue that I spelled the method names correctly, which is valuable feedback.

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

No branches or pull requests

1 participant