Skip to content

Commit 2e690de

Browse files
朱斌Rennbon
authored andcommitted
refact: rm testify
1 parent 7799af2 commit 2e690de

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ module github.com/DATA-DOG/go-sqlmock
22

33
go 1.15
44

5-
require (
6-
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46
7-
github.com/stretchr/testify v1.7.0 // indirect
8-
)
5+
require github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46

go.sum

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
31
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46 h1:veS9QfglfvqAw2e+eeNT/SbGySq8ajECXJ9e4fPoLhY=
42
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE=
5-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
8-
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
9-
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
10-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
11-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
12-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

rows_test.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"database/sql"
66
"database/sql/driver"
77
"fmt"
8-
"github.com/stretchr/testify/assert"
8+
"reflect"
99
"testing"
1010
"time"
1111
)
@@ -774,9 +774,14 @@ func TestNewRowsFromStruct(t *testing.T) {
774774
if err != nil {
775775
t.Fatal(err)
776776
}
777-
assert.EqualValues(t, excepted.cols, actual.cols)
778-
assert.EqualValues(t, excepted.rows, actual.rows)
779-
assert.EqualValues(t, excepted.def, actual.def)
777+
same := reflect.DeepEqual(excepted.cols, actual.cols)
778+
if !same {
779+
t.Fatal("custom tag reflect failed")
780+
}
781+
same = reflect.DeepEqual(excepted.rows, actual.rows)
782+
if !same {
783+
t.Fatal("reflect value from tag failed")
784+
}
780785
}
781786

782787
func TestNewRowsFromStructs(t *testing.T) {
@@ -796,11 +801,16 @@ func TestNewRowsFromStructs(t *testing.T) {
796801
for _, v := range arr {
797802
excepted.AddRow(v.Type, v.Name, v.CreateTime)
798803
}
799-
actual, err := NewRowsFromStructs("mock", arr[0],arr[1])
804+
actual, err := NewRowsFromStructs("mock", arr[0], arr[1])
800805
if err != nil {
801806
t.Fatal(err)
802807
}
803-
assert.EqualValues(t, excepted.cols, actual.cols)
804-
assert.EqualValues(t, excepted.rows, actual.rows)
805-
assert.EqualValues(t, excepted.def, actual.def)
808+
same := reflect.DeepEqual(excepted.cols, actual.cols)
809+
if !same {
810+
t.Fatal("custom tag reflect failed")
811+
}
812+
same = reflect.DeepEqual(excepted.rows, actual.rows)
813+
if !same {
814+
t.Fatal("reflect value from tag failed")
815+
}
806816
}

0 commit comments

Comments
 (0)