ytid/ytid_test.go

32 lines
496 B
Go
Raw Normal View History

2019-07-01 15:47:29 +02:00
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)
}
}
}
}