You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
553 B
Go
31 lines
553 B
Go
package concurrency
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func mockWebsiteChecker(url string) bool {
|
|
return url != "waat://furhurterwe.geds"
|
|
}
|
|
|
|
func TestWebsites(t *testing.T) {
|
|
websites := []string{
|
|
"http://google.com",
|
|
"http://hackaday.com",
|
|
"waat://furhurterwe.geds",
|
|
}
|
|
|
|
want := map[string]bool{
|
|
"http://google.com": true,
|
|
"http://hackaday.com": true,
|
|
"waat://furhurterwe.geds": false,
|
|
}
|
|
|
|
got := CheckWebsites(mockWebsiteChecker, websites)
|
|
|
|
if !reflect.DeepEqual(want, got) {
|
|
t.Fatalf("Wanted %v, got %v", want, got)
|
|
}
|
|
}
|