initial
This commit is contained in:
31
ytid_test.go
Normal file
31
ytid_test.go
Normal 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)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user