-
Notifications
You must be signed in to change notification settings - Fork 101
Minor refactoring of acceptance_test.go: print warnings on closing errors #2545
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
Conversation
w.Close() | ||
err := w.Close() | ||
if err != nil { | ||
t.Logf("Warning: failed to close pipe writer: %v", err) |
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.
was this caused by a real issue you saw?
prepares := []string{} | ||
cleanups := []string{} | ||
var prepares []string | ||
var cleanups []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.
Unless we have agreed to one style over whole codebase let's avoid this type of changes.
@@ -542,7 +542,7 @@ func doComparison(t *testing.T, repls testdiff.ReplacementsContext, dirRef, dirN | |||
} | |||
|
|||
// The test produced an unexpected output file. | |||
if !okRef && okNew { |
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.
Why was this changed? This deserves its own PR with explanation.
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.
In this statement, if okRef
is false, then okNew
is always true due to a previous if !okRef && !okNew { return }
statement in this method. Removing the second condition here makes it easier to comprehend this check. If you agree this is valuable, i will open a separate PR.
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.
I think it's easier to read (and more resilient to refactorings) if you don't need to know all the code before it.
This PR has not received an update in a while. If you want to keep this PR open, please leave a comment below or push a new commit and auto-close will be canceled. |
Changes
VerboseTest
Why
2-4. These changes suggest slightly more idiomatic source code
Tests
existing tests