From 6f8b26d54eda99a43e6999af6093fab210f66ec8 Mon Sep 17 00:00:00 2001 From: sia Date: Tue, 2 Jul 2024 18:47:24 +0800 Subject: [PATCH] update test and example code --- slice_example_test.go | 4 ++-- slice_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/slice_example_test.go b/slice_example_test.go index 8dea28b6..3da33196 100644 --- a/slice_example_test.go +++ b/slice_example_test.go @@ -88,10 +88,10 @@ func ExampleForEach() { // 3 // 4 } -func ExampleForEachCondition() { +func ExampleForForEachWhile() { list := []int64{1, 2, -math.MaxInt, 4} - ForEachCondition(list, func(x int64, _ int) bool { + ForEachWhile(list, func(x int64, _ int) bool { if x < 0 { return false } diff --git a/slice_test.go b/slice_test.go index 7c8a8316..26ea7503 100644 --- a/slice_test.go +++ b/slice_test.go @@ -157,7 +157,7 @@ func TestForEach(t *testing.T) { is.IsIncreasing(callParams2) } -func TestForEachCondition(t *testing.T) { +func TestForEachWhile(t *testing.T) { t.Parallel() is := assert.New(t) @@ -166,7 +166,7 @@ func TestForEachCondition(t *testing.T) { var callParams1 []string var callParams2 []int - ForEachCondition([]string{"a", "b", "c"}, func(item string, i int) bool { + ForEachWhile([]string{"a", "b", "c"}, func(item string, i int) bool { if item == "c" { return false }