fix: unit tests

pull/41/head
Unlock Music Dev 2 years ago
parent f6748d644d
commit bd95fdb53b
No known key found for this signature in database
GPG Key ID: 95202E10D3413A1D

@ -45,11 +45,11 @@ func TestMflac0Decoder_Read(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
d, err := NewDecoder(bytes.NewReader(raw)) d := NewDecoder(bytes.NewReader(raw))
if err != nil { if err := d.Validate(); err != nil {
t.Error(err) t.Errorf("validate file error = %v", err)
return
} }
buf := make([]byte, len(target)) buf := make([]byte, len(target))
if _, err := io.ReadFull(d, buf); err != nil { if _, err := io.ReadFull(d, buf); err != nil {
t.Errorf("read bytes from decoder error = %v", err) t.Errorf("read bytes from decoder error = %v", err)
@ -81,19 +81,12 @@ func TestMflac0Decoder_Validate(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
d, err := NewDecoder(bytes.NewReader(raw)) d := NewDecoder(bytes.NewReader(raw))
if err != nil {
t.Error(err)
return
}
if err := d.Validate(); err != nil { if err := d.Validate(); err != nil {
t.Errorf("read bytes from decoder error = %v", err) t.Errorf("read bytes from decoder error = %v", err)
return return
} }
if tt.fileExt != d.GetFileExt() {
t.Errorf("Decrypt() got = %v, want %v", d.GetFileExt(), tt.fileExt)
}
}) })
} }
} }

Loading…
Cancel
Save