follow go style of table-driven tests more closesly#31
follow go style of table-driven tests more closesly#31SaketramDurbha wants to merge 3 commits intoGoogleCloudPlatform:masterfrom
Conversation
internal/lifecycle/readme_test.go
Outdated
| if len(tc.codeBlock) == 0 { | ||
| continue | ||
| } | ||
| t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { |
There was a problem hiding this comment.
Instead of just giving a number here, your first arg to T.Run should be a test case description. Add a name field to toCommandsTest and fill that with a brief description, replacing the comments that you have added to each case. That way when there's a failure it's clear from the output which test case failed.
There was a problem hiding this comment.
Resolved, thank you. Does the updated version have the description format you were looking for?
|
Also uncommenting a test case that was originally commented out, addressed by #29. |
tritone
left a comment
There was a problem hiding this comment.
Generally looks good, two small things. Run go test -v to see the full output and confirm that it's what you're expecting.
internal/lifecycle/readme_test.go
Outdated
| }, | ||
| cmds: []*exec.Cmd{ | ||
| exec.Command("echo", "hello", "world"), | ||
| exec.Command("echo", "hello", "wosrld"), |
internal/lifecycle/readme_test.go
Outdated
| var toCommandsTests = []toCommandsTest{ | ||
| // single one-line command | ||
| { | ||
| description: "single one-line command test", |
There was a problem hiding this comment.
You can leave "test" off the end of all of these.
In response to: #25 (comment)
Use
T.Runfor creating subtests for each test case.