1
0
forked from um/cli

fix: unit tests

This commit is contained in:
Unlock Music Dev 2022-11-20 02:53:04 +08:00
parent f6748d644d
commit bd95fdb53b
Signed by untrusted user: um-dev
GPG Key ID: 95202E10D3413A1D

View File

@ -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)
}
}) })
} }
} }