Skip to content

Commit

Permalink
refact: rm testify
Browse files Browse the repository at this point in the history
Author:    Rennbon <343688972@qq.com>
  • Loading branch information
Rennbon committed Dec 8, 2021
1 parent eb54fbc commit 462cf4b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ module github.com/DATA-DOG/go-sqlmock

go 1.15

require (
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46
github.com/stretchr/testify v1.7.0 // indirect
)
require github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46
10 changes: 0 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46 h1:veS9QfglfvqAw2e+eeNT/SbGySq8ajECXJ9e4fPoLhY=
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
26 changes: 18 additions & 8 deletions rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"database/sql"
"database/sql/driver"
"fmt"
"github.com/stretchr/testify/assert"
"reflect"
"testing"
"time"
)
Expand Down Expand Up @@ -774,9 +774,14 @@ func TestNewRowsFromStruct(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.EqualValues(t, excepted.cols, actual.cols)
assert.EqualValues(t, excepted.rows, actual.rows)
assert.EqualValues(t, excepted.def, actual.def)
same := reflect.DeepEqual(excepted.cols, actual.cols)
if !same {
t.Fatal("custom tag reflect failed")
}
same = reflect.DeepEqual(excepted.rows, actual.rows)
if !same {
t.Fatal("reflect value from tag failed")
}
}

func TestNewRowsFromStructs(t *testing.T) {
Expand All @@ -796,11 +801,16 @@ func TestNewRowsFromStructs(t *testing.T) {
for _, v := range arr {
excepted.AddRow(v.Type, v.Name, v.CreateTime)
}
actual, err := NewRowsFromStructs("mock", arr[0],arr[1])
actual, err := NewRowsFromStructs("mock", arr[0], arr[1])
if err != nil {
t.Fatal(err)
}
assert.EqualValues(t, excepted.cols, actual.cols)
assert.EqualValues(t, excepted.rows, actual.rows)
assert.EqualValues(t, excepted.def, actual.def)
same := reflect.DeepEqual(excepted.cols, actual.cols)
if !same {
t.Fatal("custom tag reflect failed")
}
same = reflect.DeepEqual(excepted.rows, actual.rows)
if !same {
t.Fatal("reflect value from tag failed")
}
}

0 comments on commit 462cf4b

Please sign in to comment.