-
Notifications
You must be signed in to change notification settings - Fork 0
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
Test structify.MakeMapStructifier() #33
base: main
Are you sure you want to change the base?
Conversation
c99c4f3
to
37f5d94
Compare
structify/structify_test.go
Outdated
func TestMakeMapStructifier(t *testing.T) { | ||
subtests := []struct { | ||
name string | ||
tag string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tag
is actually hard-coded, so it does not make sense to always specify it. If the empty
test is the only case in which it must be the empty string, make a separate test.
structify/structify_test.go
Outdated
Inline stringTest `test:",inline"` | ||
}{Inline: stringTest{S: "foobar"}}}, | ||
{"missing_inline", "test", nil, map[string]any{"s": "foobar"}, false, &struct { | ||
Inline stringTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about an actual test for embedded structs?
structify/structify_test.go
Outdated
{"dash_tag", "test", nil, map[string]any{"s": "foobar"}, false, &struct { | ||
S string `test:"-"` | ||
}{}}, | ||
{"missing", "test", nil, nil, false, &stringTest{}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing what?
structify/structify_test.go
Outdated
error bool | ||
output any | ||
}{ | ||
{"empty", "", nil, nil, false, &struct{}{}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wall of code is barely readable, and testing is about what is actually being tested, so please make it readable instead of always trying to save lines at all costs.
37f5d94
to
deb4a1d
Compare
No description provided.