Skip to content

Commit 8302de9

Browse files
authoredOct 26, 2024··
Merge branch 'master' into master
2 parents 6555fd4 + 89352f7 commit 8302de9

File tree

7 files changed

+239
-201
lines changed

7 files changed

+239
-201
lines changed
 

‎README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Testify - Thou Shalt Write Tests
22
================================
33

4-
ℹ️ We are working on testify v2 and would love to hear what you'd like to see in it, have your say here: https://cutt.ly/testify
4+
> [!NOTE]
5+
> Testify is being maintained at v1, no breaking changes will be accepted in this repo.
6+
> [See discussion about v2](https://github.com/stretchr/testify/discussions/1560).
57
68
[![Build Status](https://github.com/stretchr/testify/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/stretchr/testify/actions/workflows/main.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/testify)](https://goreportcard.com/report/github.com/stretchr/testify) [![PkgGoDev](https://pkg.go.dev/badge/github.com/stretchr/testify)](https://pkg.go.dev/github.com/stretchr/testify)
79

‎_codegen/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ func parseTemplates() (*template.Template, *template.Template, error) {
107107
}
108108
funcTemplate = string(f)
109109
}
110-
tmpl, err := template.New("function").Parse(funcTemplate)
110+
tmpl, err := template.New("function").Funcs(template.FuncMap{
111+
"replace": strings.ReplaceAll,
112+
}).Parse(funcTemplate)
111113
if err != nil {
112114
return nil, nil, err
113115
}

‎assert/assertions.go

-15
Original file line numberDiff line numberDiff line change
@@ -621,21 +621,6 @@ func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs ..
621621
return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...)
622622
}
623623

624-
if aType.Kind() == reflect.Ptr {
625-
aType = aType.Elem()
626-
}
627-
if bType.Kind() == reflect.Ptr {
628-
bType = bType.Elem()
629-
}
630-
631-
if aType.Kind() != reflect.Struct {
632-
return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", aType.Kind(), reflect.Struct), msgAndArgs...)
633-
}
634-
635-
if bType.Kind() != reflect.Struct {
636-
return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", bType.Kind(), reflect.Struct), msgAndArgs...)
637-
}
638-
639624
expected = copyExportedFields(expected)
640625
actual = copyExportedFields(actual)
641626

‎assert/assertions_test.go

+50
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,56 @@ func TestEqualExportedValues(t *testing.T) {
449449
+ Exported: (int) 1,
450450
notExported: (interface {}) <nil>`,
451451
},
452+
{
453+
value1: []int{1, 2},
454+
value2: []int{1, 2},
455+
expectedEqual: true,
456+
},
457+
{
458+
value1: []int{1, 2},
459+
value2: []int{1, 3},
460+
expectedEqual: false,
461+
expectedFail: `
462+
Diff:
463+
--- Expected
464+
+++ Actual
465+
@@ -2,3 +2,3 @@
466+
(int) 1,
467+
- (int) 2
468+
+ (int) 3
469+
}`,
470+
},
471+
{
472+
value1: []*Nested{
473+
{1, 2},
474+
{3, 4},
475+
},
476+
value2: []*Nested{
477+
{1, "a"},
478+
{3, "b"},
479+
},
480+
expectedEqual: true,
481+
},
482+
{
483+
value1: []*Nested{
484+
{1, 2},
485+
{3, 4},
486+
},
487+
value2: []*Nested{
488+
{1, "a"},
489+
{2, "b"},
490+
},
491+
expectedEqual: false,
492+
expectedFail: `
493+
Diff:
494+
--- Expected
495+
+++ Actual
496+
@@ -6,3 +6,3 @@
497+
(*assert.Nested)({
498+
- Exported: (int) 3,
499+
+ Exported: (int) 2,
500+
notExported: (interface {}) <nil>`,
501+
},
452502
}
453503

454504
for _, c := range cases {

‎doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ** We are working on testify v2 and would love to hear what you'd like to see in it, have your say here: https://cutt.ly/testify **
21
// Package testify is a set of packages that provide many tools for testifying that your code will behave as you intend.
32
//
43
// testify contains the following packages:

0 commit comments

Comments
 (0)
Please sign in to comment.