X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/72dd37f1abb2b550aaaac48eac677403d5664797..e995052ef530b1eae2d0476ff519f7225bbb481d:/hotline/file_name_with_info_test.go diff --git a/hotline/file_name_with_info_test.go b/hotline/file_name_with_info_test.go index 3ca2c30..0473631 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" ) @@ -48,7 +49,7 @@ func TestFileNameWithInfo_MarshalBinary(t *testing.T) { fileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader, 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 @@ -72,7 +73,7 @@ func TestFileNameWithInfo_UnmarshalBinary(t *testing.T) { name string fields fields args args - want *FileNameWithInfo + want *FileNameWithInfo wantErr bool }{ { @@ -108,12 +109,12 @@ func TestFileNameWithInfo_UnmarshalBinary(t *testing.T) { fileNameWithInfoHeader: tt.fields.fileNameWithInfoHeader, name: tt.fields.name, } - if err := f.UnmarshalBinary(tt.args.data); (err != nil) != tt.wantErr { - t.Errorf("UnmarshalBinary() error = %v, wantErr %v", err, 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) { t.Errorf("Read() got = %v, want %v", f, tt.want) } }) } -} \ No newline at end of file +}