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

Skip creating args for case when only one TestParams #74

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mekegi
Copy link
Contributor

@mekegi mekegi commented Jul 17, 2018

A lot of cases when func with one param func Sin(x int) int,
or writers func Write(w io.Writer, b []bytes)
and in generated tests for such func we see a lot of boilercode like
type args struct { x int }
In my pull request I try ti prevent creating unuseful args type for one param
Now generated tests looks like:

	tests := []struct {
		name string
		arg  string
	}{
	// TODO: Add test cases.
	}
	for _, tt := range tests {
		Foo3(tt.arg)
	}

instead of

	type args struct {
		s string
	}
	tests := []struct {
		name string
		args args
	}{
	// TODO: Add test cases.
	}
	for _, tt := range tests {
		Foo3(tt.args.s)
	}

mekegi and others added 2 commits July 17, 2018 19:07
```
	tests := []struct {
		name string
		arg  string
	}{
	// TODO: Add test cases.
	}
	for _, tt := range tests {
		Foo3(tt.arg)
	}
```
instead of
```
	type args struct {
		s string
	}
	tests := []struct {
		name string
		args args
	}{
	// TODO: Add test cases.
	}
	for _, tt := range tests {
		Foo3(tt.args.s)
	}
```
@coveralls
Copy link

coveralls commented Jul 17, 2018

Coverage Status

Coverage remained the same at 96.327% when pulling 45ff4bc on mekegi:master into a680bea on cweill:master.

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.

2 participants