mirror of
https://github.com/golang/go
synced 2024-10-14 03:43:28 +00:00
os: fix wrong error msg from TestDoubleCloseError
When the type assertion fails, the test mistakenly prints the expected (rather than the actual) type. When the error string doesn't match, the text mistakenly prints the original (rather than the converted) error (although there might not be any difference in the output, the code looks wrong). Fix both issues. Change-Id: Ia7dd0632fc677f458fec25d899c46268a12f76e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/428916 Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
d75e91740a
commit
3585e9be67
|
@ -2539,9 +2539,9 @@ func testDoubleCloseError(t *testing.T, path string) {
|
|||
if err := file.Close(); err == nil {
|
||||
t.Error("second Close did not fail")
|
||||
} else if pe, ok := err.(*PathError); !ok {
|
||||
t.Errorf("second Close returned unexpected error type %T; expected fs.PathError", pe)
|
||||
t.Errorf("second Close: got %T, want %T", err, pe)
|
||||
} else if pe.Err != ErrClosed {
|
||||
t.Errorf("second Close returned %q, wanted %q", err, ErrClosed)
|
||||
t.Errorf("second Close: got %q, want %q", pe.Err, ErrClosed)
|
||||
} else {
|
||||
t.Logf("second close returned expected error %q", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue