5
5
"database/sql"
6
6
"database/sql/driver"
7
7
"fmt"
8
- "github.com/stretchr/testify/assert "
8
+ "reflect "
9
9
"testing"
10
10
"time"
11
11
)
@@ -774,9 +774,14 @@ func TestNewRowsFromStruct(t *testing.T) {
774
774
if err != nil {
775
775
t .Fatal (err )
776
776
}
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
+ }
780
785
}
781
786
782
787
func TestNewRowsFromStructs (t * testing.T ) {
@@ -796,11 +801,16 @@ func TestNewRowsFromStructs(t *testing.T) {
796
801
for _ , v := range arr {
797
802
excepted .AddRow (v .Type , v .Name , v .CreateTime )
798
803
}
799
- actual , err := NewRowsFromStructs ("mock" , arr [0 ],arr [1 ])
804
+ actual , err := NewRowsFromStructs ("mock" , arr [0 ], arr [1 ])
800
805
if err != nil {
801
806
t .Fatal (err )
802
807
}
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
+ }
806
816
}
0 commit comments