MCPcopy Create free account
hub / github.com/github/gh-aw / TestAny_StopsEarly

Function TestAny_StopsEarly

pkg/sliceutil/sliceutil_test.go:291–299  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

289}
290
291func TestAny_StopsEarly(t *testing.T) {
292 callCount := 0
293 slice := []int{1, 2, 3, 4, 5}
294 Any(slice, func(x int) bool {
295 callCount++
296 return x == 2 // matches at index 1
297 })
298 assert.Equal(t, 2, callCount, "Any should stop evaluating after first match")
299}
300
301func TestMergeUnique(t *testing.T) {
302 tests := []struct {

Callers

nothing calls this directly

Calls 1

AnyFunction · 0.85

Tested by

no test coverage detected