1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 07:42:27 +08:00

feat: add ForEach func

This commit is contained in:
dudaodong
2022-03-30 19:41:55 +08:00
parent 1a436aeb41
commit 3ad142d5d7
2 changed files with 26 additions and 0 deletions

View File

@@ -62,3 +62,22 @@ func TestMerge(t *testing.T) {
assert.Equal(expected, acturl)
}
func TestForEach(t *testing.T) {
assert := internal.NewAssert(t, "TestForEach")
m := map[string]int{
"a": 1,
"b": 2,
"c": 3,
"d": 4,
}
var sum int
ForEach(m, func(_ string, value int) {
sum += value
})
assert.Equal(10, sum)
}