package main import ( "io/ioutil" "path" "runtime" "strings" "testing" ) func readDataFile(t *testing.T, filename string) string { _, sourceName, _, _ := runtime.Caller(0) projectRoot := path.Join(path.Dir(sourceName), "..") dir := path.Join(projectRoot, filename) data, err := ioutil.ReadFile(dir) if err != nil { t.Fatal(err) } return string(data) } func TestBirdRouteToGraphvizXSS(t *testing.T) { setting.dnsInterface = "" // Don't change formatting of the following strings! fakeResult := `` result := birdRouteToGraphviz([]string{ "alpha", }, []string{ fakeResult, }, fakeResult) if strings.Contains(result, "