mirror of
https://github.com/tomnomnom/gron
synced 2024-10-18 08:42:21 +00:00
26 lines
428 B
Go
26 lines
428 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestValidURL(t *testing.T) {
|
|
tests := []struct {
|
|
url string
|
|
want bool
|
|
}{
|
|
{"http://test.com", true},
|
|
{"https://test.com", true},
|
|
{"HttPs://test.com", true},
|
|
{"/test/test.com", false},
|
|
{"", false},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
have := validURL(test.url)
|
|
if have != test.want {
|
|
t.Errorf("Want %t for validURL(%s); have %t", test.want, test.url, have)
|
|
}
|
|
}
|
|
}
|