40 lines
787 B
Go
40 lines
787 B
Go
package player
|
|
|
|
import "testing"
|
|
|
|
func TestIsHLS(t *testing.T) {
|
|
if !isHLS(".m3u8") {
|
|
t.Error(".m3u8 should be HLS")
|
|
}
|
|
for _, ext := range []string{".mp3", ".m3u", ".aac", ""} {
|
|
if isHLS(ext) {
|
|
t.Errorf("%q should not be HLS", ext)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestNeedsFFmpeg(t *testing.T) {
|
|
tests := []struct {
|
|
ext string
|
|
want bool
|
|
}{
|
|
{ext: ".aac", want: true},
|
|
{ext: ".aacp", want: true},
|
|
{ext: ".opus", want: true},
|
|
{ext: ".mp3", want: false},
|
|
{ext: ".ogg", want: false},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
if got := needsFFmpeg(tt.ext); got != tt.want {
|
|
t.Errorf("needsFFmpeg(%q) = %v, want %v", tt.ext, got, tt.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestSupportedExtsIncludesAACP(t *testing.T) {
|
|
if !SupportedExts[".aacp"] {
|
|
t.Fatal("SupportedExts[.aacp] = false, want true")
|
|
}
|
|
}
|