forked from grafov/m3u8
-
Notifications
You must be signed in to change notification settings - Fork 1
/
structure_test.go
62 lines (48 loc) · 1.13 KB
/
structure_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
62
/*
Playlist structures tests.
Copyright 2013-2017 The Project Developers.
See the AUTHORS and LICENSE files at the top-level directory of this distribution
and at https://github.com/grafov/m3u8/
ॐ तारे तुत्तारे तुरे स्व
*/
package m3u8
import (
"bytes"
"testing"
)
func CheckType(t *testing.T, p Playlist) {
t.Logf("%T implements Playlist interface OK\n", p)
}
// Create new media playlist.
func TestNewMediaPlaylist(t *testing.T) {
_, e := NewMediaPlaylist(1, 2)
if e != nil {
t.Fatalf("Create media playlist failed: %s", e)
}
}
type MockCustomTag struct {
name string
err error
segment bool
encodedString string
}
func (t *MockCustomTag) TagName() string {
return t.name
}
func (t *MockCustomTag) Decode(line string) (CustomTag, error) {
return t, t.err
}
func (t *MockCustomTag) Encode() *bytes.Buffer {
if t.encodedString == "" {
return nil
}
buf := new(bytes.Buffer)
buf.WriteString(t.encodedString)
return buf
}
func (t *MockCustomTag) String() string {
return t.encodedString
}
func (t *MockCustomTag) SegmentTag() bool {
return t.segment
}