Skip to content

Commit 5a66f27

Browse files
committed
test: add more test cases of map helper functions.
1 parent 2386a55 commit 5a66f27

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

util_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ func TestIsMapHasKey(t *testing.T) {
154154
"a": 1,
155155
1: 2,
156156
}, "a"))
157+
assert.NotTrue(isMapHasKey(map[any]int{
158+
"a": 1,
159+
1: 2,
160+
}, 2))
161+
assert.NotTrue(isMapHasKey(map[any]int{
162+
"a": 1,
163+
1: 2,
164+
}, "b"))
157165
assert.NotTrue(isMapHasKey(map[any]int{
158166
"a": 1,
159167
1: 2,
@@ -177,6 +185,26 @@ func TestIsMapHasValue(t *testing.T) {
177185
"a": 1,
178186
"b": 2,
179187
}, true))
188+
assert.True(isMapHasValue(map[any]any{
189+
"a": "b",
190+
1: 2,
191+
}, "b"))
192+
assert.True(isMapHasValue(map[any]any{
193+
"a": "b",
194+
1: 2,
195+
}, 2))
196+
assert.NotTrue(isMapHasValue(map[any]any{
197+
"a": "b",
198+
1: 2,
199+
}, "a"))
200+
assert.NotTrue(isMapHasValue(map[any]any{
201+
"a": "b",
202+
1: 2,
203+
}, 1))
204+
assert.NotTrue(isMapHasValue(map[any]any{
205+
"a": "b",
206+
1: 2,
207+
}, 1.1))
180208
}
181209

182210
func TestIsNil(t *testing.T) {

0 commit comments

Comments
 (0)