mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
Also - Add more complicated report.json for benchmark - Break up report/topology.go - Implement our own DeepEqual for ps.Map
27 lines
614 B
Go
27 lines
614 B
Go
package report_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/weaveworks/scope/report"
|
|
)
|
|
|
|
func TestStringSetContains(t *testing.T) {
|
|
for _, testcase := range []struct {
|
|
contents []string
|
|
target string
|
|
want bool
|
|
}{
|
|
{nil, "foo", false},
|
|
{[]string{}, "foo", false},
|
|
{[]string{"a"}, "foo", false},
|
|
{[]string{"a", "foo"}, "foo", true},
|
|
{[]string{"foo", "b"}, "foo", true},
|
|
} {
|
|
have := report.MakeStringSet(testcase.contents...).Contains(testcase.target)
|
|
if testcase.want != have {
|
|
t.Errorf("%+v.Contains(%q): want %v, have %v", testcase.contents, testcase.target, testcase.want, have)
|
|
}
|
|
}
|
|
}
|