From 3422dbcfc26d8beca5bbbc8dd64ff191c716d67b Mon Sep 17 00:00:00 2001 From: johnwong <124032292+justinwongcn@users.noreply.github.com> Date: Sat, 25 Jan 2025 00:11:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(iox):=20=E4=BF=AE=E5=A4=8D=E7=A9=BA?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E5=8F=8A?= =?UTF-8?q?=E7=AE=80=E5=8C=96=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iox/multiple_bytes_test.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/iox/multiple_bytes_test.go b/iox/multiple_bytes_test.go index aa6e462..8c358eb 100644 --- a/iox/multiple_bytes_test.go +++ b/iox/multiple_bytes_test.go @@ -34,7 +34,7 @@ func TestMultipleBytesReadWrite(t *testing.T) { name: "空读取", write: []byte{}, readSize: 1, - wantRead: []byte{}, + wantRead: []byte{0}, wantN: 0, wantErr: io.EOF, }, @@ -73,13 +73,9 @@ func TestMultipleBytesReadWrite(t *testing.T) { read := make([]byte, tc.readSize) n, err = mb.Read(read) - if tc.wantErr != nil { - assert.Equal(t, tc.wantErr, err) - } else { - assert.Nil(t, err) - assert.Equal(t, tc.wantN, n, "读取的字节数应该等于期望的字节数") - assert.Equal(t, tc.wantRead, read, "读取的数据应该等于期望读取的数据") - } + assert.Equal(t, tc.wantErr, err) + assert.Equal(t, tc.wantN, n, "读取的字节数应该等于期望的字节数") + assert.Equal(t, tc.wantRead, read, "读取的数据应该等于期望读取的数据") }) } }