Skip to content
This repository was archived by the owner on Oct 27, 2022. It is now read-only.

Conversation

SaketramDurbha
Copy link
Contributor

@SaketramDurbha SaketramDurbha commented Aug 22, 2020

In response to: #25 (comment)

Use T.Run for creating subtests for each test case.

if len(tc.codeBlock) == 0 {
continue
}
t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved, thank you. Does the updated version have the description format you were looking for?

@SaketramDurbha
Copy link
Contributor Author

Also uncommenting a test case that was originally commented out, addressed by #29.

@SaketramDurbha SaketramDurbha requested a review from tritone August 24, 2020 21:43
Copy link

@tritone tritone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, two small things. Run go test -v to see the full output and confirm that it's what you're expecting.

},
cmds: []*exec.Cmd{
exec.Command("echo", "hello", "world"),
exec.Command("echo", "hello", "wosrld"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? did you run this locally?

var toCommandsTests = []toCommandsTest{
// single one-line command
{
description: "single one-line command test",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can leave "test" off the end of all of these.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants