8000 merged stretchr/testify#1513 · go-openapi/testify@d425f21 · GitHub
[go: up one dir, main page]

Skip to content

Commit d425f21

Browse files
committed
Resolved merge conflicts with the go-openapi fork, rebase and ensured all tests pass. Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1 parent bff0b8c commit d425f21

24 files changed

+58
-52
lines changed

_codegen/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module github.com/go-openapi/testify/_codegen
1+
module github.com/go-openapi/testify/v2/_codegen
22

33
go 1.24.0

_codegen/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import (
2323
"strings"
2424
"text/template"
2525

26-
"github.com/go-openapi/testify/_codegen/internal/imports"
26+
"github.com/go-openapi/testify/v2/_codegen/internal/imports"
2727
)
2828

2929
var (
30-
pkg = flag.String("assert-path", "github.com/go-openapi/testify/assert", "Path to the assert package")
30+
pkg = flag.String("assert-path", "github.com/go-openapi/testify/v2/assert", "Path to the assert package")
3131
includeF = flag.Bool("include-format-funcs", false, "include format functions such as Errorf and Equalf")
3232
outputPkg = flag.String("output-package", "", "package for the resulting code")
3333
tmplFile = flag.String("template", "", "What file to load the function template from")

assert/assertion_compare_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func TestCompare(t *testing.T) {
2929
type customTime time.Time
3030
type customBytes []byte
3131
for _, currCase := range []struct {
32-
less interface{}
33-
greater interface{}
32+
less any
33+
greater any
3434
cType string
3535
}{
3636
{less: customString("a"), greater: customString("b"), cType: "string"},
@@ -102,7 +102,7 @@ type outputT struct {
102102
}
103103

104104
// Implements TestingT
105-
func (t *outputT) Errorf(format string, args ...interface{}) {
105+
func (t *outputT) Errorf(format string, args ...any) {
106106
s := fmt.Sprintf(format, args...)
107107
t.buf.WriteString(s)
108108
}
@@ -147,8 +147,8 @@ func TestGreater(t *testing.T) {
147147

148148
// Check error report
149149
for _, currCase := range []struct {
150-
less interface{}
151-
greater interface{}
150+
less any
151+
greater any
152152
msg string
153153
}{
154154
{less: "a", greater: "b", msg: `"a" is not greater than "b"`},
@@ -170,7 +170,7 @@ func TestGreater(t *testing.T) {
170170
out := &outputT{buf: bytes.NewBuffer(nil)}
171171
False(t, Greater(out, currCase.less, currCase.greater))
172172
Contains(t, out.buf.String(), currCase.msg)
173-
Contains(t, out.helpers, "github.com/go-openapi/testify/assert.Greater")
173+
Contains(t, out.helpers, "github.com/go-openapi/testify/v2/assert.Greater")
174174
}
175175
}
176176

@@ -193,8 +193,8 @@ func TestGreaterOrEqual(t *testing.T) {
193193

194194
// Check error report
195195
for _, currCase := range []struct {
196-
less interface{}
197-
greater interface{}
196+
less any
197+
greater any
198198
msg string
199199
}{
200200
{less: "a", greater: "b", msg: `"a" is not greater than or equal to "b"`},
@@ -216,7 +216,7 @@ func TestGreaterOrEqual(t *testing.T) {
216216
out := &outputT{buf: bytes.NewBuffer(nil)}
217217
False(t, GreaterOrEqual(out, currCase.less, currCase.greater))
218218
Contains(t, out.buf.String(), currCase.msg)
219-
Contains(t, out.helpers, "github.com/go-openapi/testify/assert.GreaterOrEqual")
219+
Contains(t, out.helpers, "github.com/go-openapi/testify/v2/assert.GreaterOrEqual")
220220
}
221221
}
222222

@@ -239,8 +239,8 @@ func TestLess(t *testing.T) {
239239

240240
// Check error report
241241
for _, currCase := range []struct {
242-
less interface{}
243-
greater interface{}
242+
less any
243+
greater any
244244
msg string
245245
}{
246246
{less: "a", greater: "b", msg: `"b" is not less than "a"`},
@@ -262,7 +262,7 @@ func TestLess(t *testing.T) {
262262
out := &outputT{buf: bytes.NewBuffer(nil)}
263263
False(t, Less(out, currCase.greater, currCase.less))
264264
Contains(t, out.buf.String(), currCase.msg)
265-
Contains(t, out.helpers, "github.com/go-openapi/testify/assert.Less")
265+
Contains(t, out.helpers, "github.com/go-openapi/testify/v2/assert.Less")
266266
}
267267
}
268268

@@ -285,8 +285,8 @@ func TestLessOrEqual(t *testing.T) {
285285

286286
// Check error report
287287
for _, currCase := range []struct {
288-
less interface{}
289-
greater interface{}
288+
less any
289+
greater any
290290
msg string
291291
}{
292292
{less: "a", greater: "b", msg: `"b" is not less than or equal to "a"`},
@@ -308,7 +308,7 @@ func TestLessOrEqual(t *testing.T) {
308308
out := &outputT{buf: bytes.NewBuffer(nil)}
309309
False(t, LessOrEqual(out, currCase.greater, currCase.less))
310310
Contains(t, out.buf.String(), currCase.msg)
311-
Contains(t, out.helpers, "github.com/go-openapi/testify/assert.LessOrEqual")
311+
Contains(t, out.helpers, "github.com/go-openapi/testify/v2/assert.LessOrEqual")
312312
}
313313
}
314314

@@ -335,7 +335,7 @@ func TestPositive(t *testing.T) {
335335

336336
// Check error report
337337
for _, currCase := range []struct {
338-
e interface{}
338+
e any
339339
msg string
340340
}{
341341
{e: int(-1), msg: `"-1" is not positive`},
@@ -349,7 +349,7 @@ func TestPositive(t *testing.T) {
349349
out := &outputT{buf: bytes.NewBuffer(nil)}
350350
False(t, Positive(out, currCase.e))
351351
Contains(t, out.buf.String(), currCase.msg)
352-
Contains(t, out.helpers, "github.com/go-openapi/testify/assert.Positive")
352+
Contains(t, out.helpers, "github.com/go-openapi/testify/v2/assert.Positive")
353353
}
354354
}
355355

@@ -376,7 +376,7 @@ func TestNegative(t *testing.T) {
376376

377377
// Check error report
378378
for _, currCase := range []struct {
379-
e interface{}
379+
e any
7D46
380380
msg string
381381
}{
382382
{e: int(1), msg: `"1" is not negative`},
@@ -390,7 +390,7 @@ func TestNegative(t *testing.T) {
390390
out := &outputT{buf: bytes.NewBuffer(nil)}
391391
False(t, Negative(out, currCase.e))
392392
Contains(t, out.buf.String(), currCase.msg)
393-
Contains(t, out.helpers, "github.com/go-openapi/testify/assert.Negative")
393+
Contains(t, out.helpers, "github.com/go-openapi/testify/v2/assert.Negative")
394394
}
395395
}
396396

@@ -400,8 +400,8 @@ func Test_compareTwoValuesDifferentValuesTypes(t *testing.T) {
400400
mockT := new(testing.T)
401401

402402
for _, currCase := range []struct {
403-
v1 interface{}
404-
v2 interface{}
403+
v1 any
404+
v2 any
405405
compareResult bool
406406
}{
407407
{v1: 123, v2: "abc"},
@@ -423,8 +423,8 @@ func Test_compareTwoValuesNotComparableValues(t *testing.T) {
423423
}
424424

425425
for _, currCase := range []struct {
426-
v1 interface{}
427-
v2 interface{}
426+
v1 any
427+
v2 any
428428
}{
429429
{v1: CompareStruct{}, v2: CompareStruct{}},
430430
{v1: map[string]int{}, v2: map[string]int{}},
@@ -441,8 +441,8 @@ func Test_compareTwoValuesCorrectCompareResult(t *testing.T) {
441441
mockT := new(testing.T)
442442

443443
for _, currCase := range []struct {
444-
v1 interface{}
445-
v2 interface{}
444+
v1 any
445+
v2 any
446446
allowedResults []compareResult
447447
}{
448448
{v1: 1, v2: 2, allowedResults: []compareResult{compareLess}},
@@ -476,7 +476,7 @@ func Test_containsValue(t *testing.T) {
476476
}
477477

478478
func TestComparingMsgAndArgsForwarding(t *testing.T) {
479-
msgAndArgs := []interface{}{"format %s %x", "this", 0xc001}
479+
msgAndArgs := []any{"format %s %x", "this", 0xc001}
480480
expectedOutput := "format this c001\n"
481481
funcs := []func(t TestingT){
482482
func(t TestingT) { Greater(t, 1, 2, msgAndArgs...) },

assert/assertions.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717
"unicode"
1818
"unicode/utf8"
1919

20-
"github.com/go-openapi/testify/assert/yaml"
21-
"github.com/go-openapi/testify/internal/difflib"
22-
"github.com/go-openapi/testify/internal/spew"
20+
"github.com/go-openapi/testify/v2/assert/yaml"
21+
"github.com/go-openapi/testify/v2/internal/difflib"
22+
"github.com/go-openapi/testify/v2/internal/spew"
23< 8E7A /code>23
)
2424

2525
//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl"

assert/cpu.out

-2.66 KB
Binary file not shown.

assert/doc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
// import (
1212
// "testing"
13-
// "github.com/stretchr/testify/assert"
13+
// "github.com/go-openapi/testify/v2/assert"
1414
// )
1515
//
1616
// func TestSomething(t *testing.T) {
@@ -26,7 +26,7 @@
2626
//
2727
// import (
2828
// "testing"
29-
// "github.com/stretchr/testify/assert"
29+
// "github.com/go-openapi/testify/v2/assert"
3030
// )
3131
//
3232
// func TestSomething(t *testing.T) {

enable/yaml/assertions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package yaml
33
import (
44
"testing"
55

6-
target "github.com/go-openapi/testify/assert"
6+
target "github.com/go-openapi/testify/v2/assert"
77
)
88

99
func TestYAMLEq_EqualYAMLString(t *testing.T) {

enable/yaml/enable_yaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package yaml
33

44
import (
5-
yamlstub "github.com/go-openapi/testify/assert/yaml"
5+
yamlstub "github.com/go-openapi/testify/v2/assert/yaml"
66

77
yaml "go.yaml.in/yaml/v3"
88
)

enable/yaml/forward_assertions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package yaml
33
import (
44
"testing"
55

6-
target "github.com/go-openapi/testify/assert"
6+
target "github.com/go-openapi/testify/v2/assert"
77
)
88

99
func TestYAMLEqWrapper_EqualYAMLString(t *testing.T) {

enable/yaml/forward_requirements_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package yaml
33
import (
44
"testing"
55

6-
target "github.com/go-openapi/testify/require"
6+
target "github.com/go-openapi/testify/v2/require"
77
)
88

99
func TestRequireYAMLEqWrapper_EqualYAMLString(t *testing.T) {

0 commit comments

Comments
 (0)
0