This commit is contained in:
2019-07-01 15:47:29 +02:00
commit 48a3a6e79d
4 changed files with 85 additions and 0 deletions

31
ytid_test.go Normal file
View File

@ -0,0 +1,31 @@
package ytid
import (
"testing"
)
func TestGetID(t *testing.T) {
inputs := []string{
"https://www.youtube.com/watch?v=m4U232MuTG4",
"https://youtu.be/dVtehSbLO8M",
"https://www.youtube.com/embed/Kt-tLuszKBA",
}
for n, i := range inputs {
switch n {
case 0:
if GetID(i) != "m4U232MuTG4" {
t.Fatal("failed", n)
}
case 1:
if GetID(i) != "dVtehSbLO8M" {
t.Fatal("failed", n)
}
case 2:
if GetID(i) != "Kt-tLuszKBA" {
t.Fatal("failed", n)
}
}
}
}