Files
weave-scope/test/diff.go
Tom Wilkie 25ca0c0eb7 Add ContainerImage topology and use it to build the Container By Image graph.
This makes container image details show the containers (and processes) correctly.

Also:
- introduces a 'test' package, moved Diff function there.
- adds some tests for this new rendered view.
2015-06-18 09:16:20 +00:00

23 lines
458 B
Go

package test
import (
"github.com/davecgh/go-spew/spew"
"github.com/pmezard/go-difflib/difflib"
)
func init() {
spew.Config.SortKeys = true // :\
}
// Diff diff diff
func Diff(want, have interface{}) string {
text, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
A: difflib.SplitLines(spew.Sdump(want)),
B: difflib.SplitLines(spew.Sdump(have)),
FromFile: "want",
ToFile: "have",
Context: 3,
})
return "\n" + text
}