X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/8fc43f8e53a60144f49b92a0c28b0c939a69d1c9..45ca5d60383cbe270624c713b916da29af7ba88f:/hotline/file_name_with_info_test.go?ds=sidebyside diff --git a/hotline/file_name_with_info_test.go b/hotline/file_name_with_info_test.go index 1637a64..321e247 100644 --- a/hotline/file_name_with_info_test.go +++ b/hotline/file_name_with_info_test.go @@ -2,6 +2,7 @@ package hotline import ( "github.com/stretchr/testify/assert" + "io" "reflect" "testing" ) @@ -46,9 +47,9 @@ func TestFileNameWithInfo_MarshalBinary(t *testing.T) { t.Run(tt.name, func(t *testing.T) { f := &FileNameWithInfo{ fileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader, - name: tt.fields.name, + Name: tt.fields.name, } - gotData, err := f.MarshalBinary() + gotData, err := io.ReadAll(f) if (err != nil) != tt.wantErr { t.Errorf("MarshalBinary() error = %v, wantErr %v", err, tt.wantErr) return @@ -97,7 +98,7 @@ func TestFileNameWithInfo_UnmarshalBinary(t *testing.T) { NameScript: [2]byte{0, 0}, NameSize: [2]byte{0x00, 0x0e}, }, - name: []byte("Audion.app.zip"), + Name: []byte("Audion.app.zip"), }, wantErr: false, }, @@ -106,9 +107,9 @@ func TestFileNameWithInfo_UnmarshalBinary(t *testing.T) { t.Run(tt.name, func(t *testing.T) { f := &FileNameWithInfo{ fileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader, - name: tt.fields.name, + Name: tt.fields.name, } - if err := f.UnmarshalBinary(tt.args.data); (err != nil) != tt.wantErr { + if _, err := f.Write(tt.args.data); (err != nil) != tt.wantErr { t.Errorf("Write() error = %v, wantErr %v", err, tt.wantErr) } if !assert.Equal(t, tt.want, f) {