]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/file_name_with_info_test.go
Convert bespoke methods to io.Reader/io.Writer interfaces
[rbdr/mobius] / hotline / file_name_with_info_test.go
index 1637a64ce38c34a352ea0ee90dbad07e67cc506b..0473631ab12e1996000a449312b837b8db26e2b0 100644 (file)
@@ -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
@@ -108,7 +109,7 @@ 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 {
+                       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) {