kopia lustrzana https://github.com/jcs/id3-go
Add v2.3 test
rodzic
e432fd7cfb
commit
eccc994d77
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2013 Michael Yang. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
package id3
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
textData = []byte{84, 80, 69, 49, 0, 0, 0, 13, 0, 0, 0, 77, 105, 99, 104, 97, 101, 108, 32, 89, 97, 110, 103}
|
||||
)
|
||||
|
||||
func TestV23Frame(t *testing.T) {
|
||||
frame := ParseV23Frame(bytes.NewReader(textData))
|
||||
textFrame, ok := frame.(*TextFrame)
|
||||
if !ok {
|
||||
t.Errorf("ParseV23Frame on text data returns wrong type")
|
||||
}
|
||||
|
||||
const text = "Michael Yang"
|
||||
if ft := textFrame.Text(); ft != text {
|
||||
t.Errorf("ParseV23Frame incorrect text, expected %s not %s", text, ft)
|
||||
}
|
||||
|
||||
const encoding = "ISO-8859-1"
|
||||
if e := textFrame.Encoding(); e != encoding {
|
||||
t.Errorf("ParseV23Frame incorrect encoding, expected %s not %s", encoding, e)
|
||||
}
|
||||
|
||||
if b := V23Bytes(frame); !bytes.Equal(textData, b) {
|
||||
t.Errorf("V23Bytes produces different byte slice, expected %v not %v", textData, b)
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue