allowing pointer
This commit is contained in:
@@ -40,6 +40,10 @@ func (m MusifyTest) RegexSong() *regexp.Regexp {
|
||||
return regexp.MustCompile(`(?i)https?://musify\.club/track/[a-z\-0-9]+`)
|
||||
}
|
||||
|
||||
func (m *MusifyTest) Init() {
|
||||
|
||||
}
|
||||
|
||||
func (m MusifyTest) FetchSong(source data.Source) (data.Song, error) {
|
||||
return data.Song{
|
||||
Name: extractNameTest(source.Url),
|
||||
@@ -63,11 +67,11 @@ func (m MusifyTest) Search(query common.Query) ([]data.MusicObject, error) {
|
||||
}
|
||||
|
||||
func TestRegister(t *testing.T) {
|
||||
if RegisterPlugin(MusifyTest{}) != nil {
|
||||
if RegisterPlugin(&MusifyTest{}) != nil {
|
||||
t.Errorf(`registering first plugin shouldn't return an error`)
|
||||
}
|
||||
|
||||
if RegisterPlugin(MusifyTest{}) == nil {
|
||||
if RegisterPlugin(&MusifyTest{}) == nil {
|
||||
t.Errorf(`registering same plugin twice should return an error`)
|
||||
}
|
||||
|
||||
@@ -81,7 +85,7 @@ func TestRegister(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchSong(t *testing.T) {
|
||||
RegisterPlugin(MusifyTest{})
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
s, err := Fetch(data.Source{
|
||||
Url: "https://musify.club/track/linkin-park-in-the-end-3058",
|
||||
@@ -102,7 +106,7 @@ func TestFetchSong(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchAlbum(t *testing.T) {
|
||||
RegisterPlugin(MusifyTest{})
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
a, err := Fetch(data.Source{
|
||||
Url: "https://musify.club/release/linkin-park-hybrid-theory-2000-188",
|
||||
@@ -123,7 +127,7 @@ func TestFetchAlbum(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchArtist(t *testing.T) {
|
||||
RegisterPlugin(MusifyTest{})
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
a, err := Fetch(data.Source{
|
||||
Url: "https://musify.club/artist/linkin-park-5",
|
||||
@@ -144,7 +148,7 @@ func TestFetchArtist(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchWrongUrl(t *testing.T) {
|
||||
RegisterPlugin(MusifyTest{})
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
_, err := Fetch(data.Source{
|
||||
Url: "https://musify.club/",
|
||||
@@ -156,7 +160,7 @@ func TestFetchWrongUrl(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNonExistentSourceType(t *testing.T) {
|
||||
RegisterPlugin(MusifyTest{})
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
_, err := Fetch(data.Source{
|
||||
Url: "https://musify.club/",
|
||||
|
||||
Reference in New Issue
Block a user