Skip to content

Commit e1d7195

Browse files
authored
Remove testify dependency (#16)
1 parent 5f54f1a commit e1d7195

3 files changed

Lines changed: 24 additions & 26 deletions

File tree

v2/debounce_test.go

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package debounce_test
22

33
import (
4+
"slices"
45
"testing"
56
"time"
67

78
"github.com/floatdrop/debounce/v2"
8-
9-
"github.com/stretchr/testify/assert"
109
)
1110

1211
// helper to collect output with a timeout
@@ -42,8 +41,11 @@ func TestDebounce_LastValueOnly(t *testing.T) {
4241
close(in)
4342
}()
4443

44+
expected := []int{4}
4545
result := collect(out, 1*time.Second)
46-
assert.Equal(t, []int{4}, result)
46+
if !slices.Equal(expected, result) {
47+
t.Errorf("expected result = %v, got %v", expected, result)
48+
}
4749
}
4850

4951
func TestDebounce_MultipleValuesSpacedOut(t *testing.T) {
@@ -60,8 +62,11 @@ func TestDebounce_MultipleValuesSpacedOut(t *testing.T) {
6062
close(in)
6163
}()
6264

65+
expected := []int{1, 2, 3}
6366
result := collect(out, 1*time.Second)
64-
assert.Equal(t, []int{1, 2, 3}, result)
67+
if !slices.Equal(expected, result) {
68+
t.Errorf("expected result = %v, got %v", expected, result)
69+
}
6570
}
6671

6772
func TestDebounce_WithLimit(t *testing.T) {
@@ -80,8 +85,11 @@ func TestDebounce_WithLimit(t *testing.T) {
8085
close(in)
8186
}()
8287

88+
expected := []int{3, 4}
8389
result := collect(out, 1*time.Second)
84-
assert.Equal(t, []int{3, 4}, result)
90+
if !slices.Equal(expected, result) {
91+
t.Errorf("expected result = %v, got %v", expected, result)
92+
}
8593
}
8694

8795
func TestDebounce_ChannelCloses(t *testing.T) {
@@ -93,8 +101,11 @@ func TestDebounce_ChannelCloses(t *testing.T) {
93101
close(in)
94102
}()
95103

104+
expected := []int{42}
96105
result := collect(out, 1*time.Second)
97-
assert.Equal(t, []int{42}, result)
106+
if !slices.Equal(expected, result) {
107+
t.Errorf("expected result = %v, got %v", expected, result)
108+
}
98109
}
99110

100111
func TestDebounce_EmptyChannelCloses(t *testing.T) {
@@ -105,14 +116,19 @@ func TestDebounce_EmptyChannelCloses(t *testing.T) {
105116
close(in)
106117
}()
107118

119+
expected := []int(nil)
108120
result := collect(out, 1*time.Second)
109-
assert.Equal(t, []int(nil), result)
121+
if !slices.Equal(expected, result) {
122+
t.Errorf("expected result = %v, got %v", expected, result)
123+
}
110124
}
111125

112126
func TestDebounce_ZeroDelay(t *testing.T) {
113127
in := make(chan int)
114128
out := debounce.Chan(in)
115-
assert.Equal(t, (<-chan int)(in), out)
129+
if (<-chan int)(in) != out {
130+
t.Errorf("expected result = %v, got %v", (<-chan int)(in), out)
131+
}
116132
}
117133

118134
func BenchmarkDebounce_Insert(b *testing.B) {

v2/go.mod

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
module github.com/floatdrop/debounce/v2
22

33
go 1.23
4-
5-
require github.com/stretchr/testify v1.10.0
6-
7-
require (
8-
github.com/davecgh/go-spew v1.1.1 // indirect
9-
github.com/pmezard/go-difflib v1.0.0 // indirect
10-
gopkg.in/yaml.v3 v3.0.1 // indirect
11-
)

v2/go.sum

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5-
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
6-
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
7-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
8-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9-
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
10-
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)