-
Notifications
You must be signed in to change notification settings - Fork 1
/
parse_test.go
executable file
·61 lines (57 loc) · 1.62 KB
/
parse_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package audiometa
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReadMP3Tags(t *testing.T) {
path, _ := filepath.Abs("testdata/testdata-mp3.mp3")
f, err := os.Open(path)
assert.NoError(t, err)
tag, err := parse(f, ParseOptions{MP3})
assert.NoError(t, err)
assert.NotEmpty(t, tag.Artist())
assert.NotEmpty(t, tag.Album())
assert.NotEmpty(t, tag.Title())
}
func TestReadM4ATags(t *testing.T) {
path, _ := filepath.Abs("testdata/testdata-m4a.m4a")
f, err := os.Open(path)
assert.NoError(t, err)
tag, err := parse(f, ParseOptions{M4A})
assert.NoError(t, err)
assert.NotEmpty(t, tag.Artist())
assert.NotEmpty(t, tag.Album())
assert.NotEmpty(t, tag.Title())
}
func TestReadFlacTags(t *testing.T) {
path, _ := filepath.Abs("testdata/testdata-flac.flac")
f, err := os.Open(path)
assert.NoError(t, err)
tag, err := parse(f, ParseOptions{FLAC})
assert.NoError(t, err)
assert.NotEmpty(t, tag.Artist())
assert.NotEmpty(t, tag.Album())
assert.NotEmpty(t, tag.Title())
}
func TestReadOggVorbisTags(t *testing.T) {
path, _ := filepath.Abs("testdata/testdata-ogg.ogg")
f, err := os.Open(path)
assert.NoError(t, err)
tag, err := parse(f, ParseOptions{OGG})
assert.NoError(t, err)
assert.NotEmpty(t, tag.Artist())
assert.NotEmpty(t, tag.Album())
assert.NotEmpty(t, tag.Title())
}
func TestReadOggOpusTags(t *testing.T) {
path, _ := filepath.Abs("testdata/testdata-opus.ogg")
f, err := os.Open(path)
assert.NoError(t, err)
tag, err := parse(f, ParseOptions{OGG})
assert.NoError(t, err)
assert.NotEmpty(t, tag.Artist())
assert.NotEmpty(t, tag.Album())
assert.NotEmpty(t, tag.Title())
}