Skip to content

Commit 4afc6c6

Browse files
authored
Merge pull request #8 from codeGROOVE-dev/fork
Remove use of testify and other related 3rd party libraries
2 parents bba6d6a + 65c58d9 commit 4afc6c6

File tree

10 files changed

+325
-601
lines changed

10 files changed

+325
-601
lines changed

README.md

Lines changed: 8 additions & 394 deletions
Large diffs are not rendered by default.

current.txt

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/custom_retry_function_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99
"testing"
1010
"time"
1111

12-
"github.com/codeGROOVE-dev/retry-go"
13-
"github.com/stretchr/testify/assert"
14-
)
12+
"github.com/codeGROOVE-dev/retry-go")
1513

1614
// RetriableError is a custom error that contains a positive duration for the next retry
1715
type RetriableError struct {
@@ -91,7 +89,10 @@ func TestCustomRetryFunction(t *testing.T) {
9189
)
9290

9391
fmt.Println("Server responds with: " + string(body))
94-
95-
assert.NoError(t, err)
96-
assert.Equal(t, "hello", string(body))
92+
if err != nil {
93+
t.Fatalf("unexpected error: %v", err)
94+
}
95+
if string(body) != "hello" {
96+
t.Errorf("expected %v, got %v", "hello", string(body))
97+
}
9798
}

examples/delay_based_on_error_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import (
1010
"testing"
1111
"time"
1212

13-
"github.com/codeGROOVE-dev/retry-go"
14-
"github.com/stretchr/testify/assert"
15-
)
13+
"github.com/codeGROOVE-dev/retry-go")
1614

1715
type RetryAfterError struct {
1816
response http.Response
@@ -74,8 +72,12 @@ func TestCustomRetryFunctionBasedOnKindOfError(t *testing.T) {
7472
}),
7573
)
7674

77-
assert.NoError(t, err)
78-
assert.NotEmpty(t, body)
75+
if err != nil {
76+
t.Fatalf("unexpected error: %v", err)
77+
}
78+
if len(body) == 0 {
79+
t.Error("expected non-empty value")
80+
}
7981
}
8082

8183
// use https://github.com/aereal/go-httpretryafter instead

examples/errors_history_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import (
66
"net/http/httptest"
77
"testing"
88

9-
"github.com/codeGROOVE-dev/retry-go"
10-
"github.com/stretchr/testify/assert"
11-
)
9+
"github.com/codeGROOVE-dev/retry-go")
1210

1311
// TestErrorHistory shows an example of how to get all the previous errors when
1412
// retry.Do ends in success
@@ -40,6 +38,10 @@ func TestErrorHistory(t *testing.T) {
4038
allErrors = append(allErrors, err)
4139
}),
4240
)
43-
assert.NoError(t, err)
44-
assert.Len(t, allErrors, 3)
41+
if err != nil {
42+
t.Fatalf("unexpected error: %v", err)
43+
}
44+
if len(allErrors) != 3 {
45+
t.Errorf("expected len(allErrors) = 3, got %d", len(allErrors))
46+
}
4547
}

examples/http_get_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import (
77
"net/http/httptest"
88
"testing"
99

10-
"github.com/codeGROOVE-dev/retry-go"
11-
"github.com/stretchr/testify/assert"
12-
)
10+
"github.com/codeGROOVE-dev/retry-go")
1311

1412
func TestGet(t *testing.T) {
1513
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -36,6 +34,10 @@ func TestGet(t *testing.T) {
3634
},
3735
)
3836

39-
assert.NoError(t, err)
40-
assert.NotEmpty(t, body)
37+
if err != nil {
38+
t.Fatalf("unexpected error: %v", err)
39+
}
40+
if len(body) == 0 {
41+
t.Error("expected non-empty value")
42+
}
4143
}

generic.txt

Lines changed: 0 additions & 46 deletions
This file was deleted.

go.mod

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
module github.com/codeGROOVE-dev/retry-go
22

33
go 1.20
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-
)

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)