Skip to content

Commit

Permalink
fix tests and linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lovromazgon committed Sep 13, 2024
1 parent 1800623 commit 7ca383b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions csync/map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,29 @@ func TestMap_Delete(t *testing.T) {
}

func TestMap_Range(t *testing.T) {
is := is.New(t)
m := NewMap[string, int]()

want := map[string]int{"foo": 1, "bar": 2}

m.Set("foo", 1)
m.Set("bar", 2)

t.Run("All", func(t *testing.T) {
is := is.New(t)
count := 0
m.Range(func(key string, value int) bool {
is.Equal(value, want[key])
count++
return true
})
is.Equal(count, 2)
})

t.Run("EarlyExit", func(t *testing.T) {
count := 1
is := is.New(t)
count := 0
m.Range(func(key string, value int) bool {
is.Equal(value, want[key])
count++
return false
})
Expand Down

0 comments on commit 7ca383b

Please sign in to comment.