Skip to content

Commit

Permalink
Add some unit tests for funcs in pkg/labels/labels.go (#7116)
Browse files Browse the repository at this point in the history
This PR is about adding some unit tests for funcs in pkg/labels/labels.go.

Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
  • Loading branch information
hs0210 authored May 12, 2020
1 parent 5fa12ae commit da217cb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/labels/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,3 +518,16 @@ func TestLabels_Has(t *testing.T) {
testutil.Equals(t, test.expected, got, "unexpected comparison result for test case %d", i)
}
}

func TestLabels_Get(t *testing.T) {
testutil.Equals(t, "", Labels{{"aaa", "111"}, {"bbb", "222"}}.Get("foo"))
testutil.Equals(t, "111", Labels{{"aaa", "111"}, {"bbb", "222"}}.Get("aaa"))
}

func TestLabels_Copy(t *testing.T) {
testutil.Equals(t, Labels{{"aaa", "111"}, {"bbb", "222"}}, Labels{{"aaa", "111"}, {"bbb", "222"}}.Copy())
}

func TestLabels_Map(t *testing.T) {
testutil.Equals(t, map[string]string{"aaa": "111", "bbb": "222"}, Labels{{"aaa", "111"}, {"bbb", "222"}}.Map())
}

0 comments on commit da217cb

Please sign in to comment.