Skip to content

Commit f30266e

Browse files
committed
Add unit test for RemoveBy()
Signed-off-by: yah01 <yah2er0ne@outlook.com>
1 parent ab16126 commit f30266e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

map_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ func TestIndexMap(t *testing.T) {
5757
assert.Nil(t, imap.GetBy(NameIndex, persons[0].Name))
5858
assert.Empty(t, imap.GetAllBy(NameIndex, persons[0].Name))
5959

60+
imap.RemoveBy(CityIndex, "San Francisco")
61+
assert.Empty(t, imap.GetAllBy(CityIndex, "San Francisco"))
62+
assert.Equal(t, 1, len(imap.GetAllBy(CityIndex, "Shanghai")))
63+
6064
// Update
6165
imap.Clear()
6266
InsertData(imap, persons)

0 commit comments

Comments
 (0)