This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
Generating unit tests for current function generates tests for other functions, too #1483
Closed
Description
openedon Jan 26, 2018
If you have two functions where one's name is a prefix of the other's and you generate unit tests for the shorter one, tests are also generated for the other one:
func foo() {}
func fooBar() {}
Upon executing "Go: Generate Unit Tests for Function" for foo()
I get a message saying "Generated: Test_foo, Test_fooBar" and the following tests:
func Test_foo(t *testing.T) {
tests := []struct {
name string
}{
// TODO: Add test cases.
}
for range tests {
t.Run(tt.name, func(t *testing.T) {
foo()
})
}
}
func Test_fooBar(t *testing.T) {
tests := []struct {
name string
}{
// TODO: Add test cases.
}
for range tests {
t.Run(tt.name, func(t *testing.T) {
fooBar()
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels