From: Kir Kolyshkin Date: Wed, 7 Sep 2022 01:09:11 +0000 (-0700) Subject: os: fix wrong error msg from TestDoubleCloseError X-Git-Tag: go1.20rc1~1099 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3585e9be670fc76e1bc4d4bfa452ee8798a127f2;p=gostls13.git 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 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Michael Knyszek --- diff --git a/src/os/os_test.go b/src/os/os_test.go index 45d3aa6b5e..4c64afaef0 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -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) }