mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
Extend TestLatestMapMerge()
Add a test case where one input is longer than the other; also run each case both ways round. Omit the case which was already the reverse of another.
This commit is contained in:
@@ -93,13 +93,6 @@ func TestLatestMapMerge(t *testing.T) {
|
||||
want: MakeStringLatestMap().
|
||||
Set("foo", now, "bar"),
|
||||
},
|
||||
"Empty b": {
|
||||
a: MakeStringLatestMap().
|
||||
Set("foo", now, "bar"),
|
||||
b: MakeStringLatestMap(),
|
||||
want: MakeStringLatestMap().
|
||||
Set("foo", now, "bar"),
|
||||
},
|
||||
"Disjoint a & b": {
|
||||
a: MakeStringLatestMap().
|
||||
Set("foo", now, "bar"),
|
||||
@@ -117,10 +110,26 @@ func TestLatestMapMerge(t *testing.T) {
|
||||
want: MakeStringLatestMap().
|
||||
Set("foo", now, "bar"),
|
||||
},
|
||||
"Longer": {
|
||||
a: MakeStringLatestMap().
|
||||
Set("PID", now, "23128").
|
||||
Set("Name", now, "curl"),
|
||||
b: MakeStringLatestMap().
|
||||
Set("PID", then, "0").
|
||||
Set("Name", now, "curl").
|
||||
Set("Domain", now, "node-a.local"),
|
||||
want: MakeStringLatestMap().
|
||||
Set("PID", now, "23128").
|
||||
Set("Name", now, "curl").
|
||||
Set("Domain", now, "node-a.local"),
|
||||
},
|
||||
} {
|
||||
if have := c.a.Merge(c.b); !reflect.DeepEqual(c.want, have) {
|
||||
t.Errorf("%s:\n%s", name, test.Diff(c.want, have))
|
||||
}
|
||||
if have := c.b.Merge(c.a); !reflect.DeepEqual(c.want, have) {
|
||||
t.Errorf("%s:\n%s", name, test.Diff(c.want, have))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user