diff --git a/digraph/graphviz_test.go b/digraph/graphviz_test.go index fce1ebb6f..69e4ebb89 100644 --- a/digraph/graphviz_test.go +++ b/digraph/graphviz_test.go @@ -24,7 +24,27 @@ b -> e actual := strings.TrimSpace(string(buf.Bytes())) expected := strings.TrimSpace(writeDotStr) - if actual != expected { + + actualLines := strings.Split(actual, "\n") + expectedLines := strings.Split(expected, "\n") + + if actualLines[0] != expectedLines[0] || + actualLines[len(actualLines)-1] != expectedLines[len(expectedLines)-1] || + len(actualLines) != len(expectedLines) { + t.Fatalf("bad: %s", actual) + } + + count := 0 + for _, el := range expectedLines[1 : len(expectedLines)-1] { + for _, al := range actualLines[1 : len(actualLines)-1] { + if el == al { + count++ + break + } + } + } + + if count != len(expectedLines)-2 { t.Fatalf("bad: %s", actual) } }