kopia lustrzana https://github.com/jcs/id3-go
33 wiersze
950 B
Go
33 wiersze
950 B
Go
// 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 v2
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestV22Frame(t *testing.T) {
|
|
textData := []byte{84, 84, 50, 0, 0, 13, 0, 77, 105, 99, 104, 97, 101, 108, 32, 89, 97, 110, 103}
|
|
frame := ParseV22Frame(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 := V22Bytes(frame); !bytes.Equal(textData, b) {
|
|
t.Errorf("V23Bytes produces different byte slice, expected %v not %v", textData, b)
|
|
}
|
|
}
|