develop
Michael Yang 2014-01-06 19:08:47 -05:00
rodzic e432fd7cfb
commit eccc994d77
1 zmienionych plików z 35 dodań i 0 usunięć

35
id3v23_test.go 100644
Wyświetl plik

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