File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -510,6 +510,7 @@ func TestParams(t *testing.T) {
510510 "" ,
511511 []byte {1 , 2 , 3 },
512512 []byte {},
513+ float32 (1.12313 ),
513514 float64 (1.12313554 ),
514515 true ,
515516 false ,
@@ -543,21 +544,22 @@ func TestParams(t *testing.T) {
543544 }
544545 case time.Time :
545546 same = decodedval .UTC () == val
546- case int64 :
547- switch intVal := val .(type ) {
547+ default :
548+ retkind := reflect .TypeOf (retval ).Kind ()
549+ switch origval := val .(type ) {
550+ case int8 :
551+ same = retkind == reflect .Int64 && decodedval == int64 (origval )
548552 case int16 :
549- same = decodedval == int64 (intVal )
553+ same = retkind == reflect . Int64 && decodedval == int64 (origval )
550554 case int32 :
551- same = decodedval == int64 (intVal )
552- case int8 :
553- same = decodedval == int64 (intVal )
555+ same = retkind == reflect .Int64 && decodedval == int64 (origval )
554556 case int :
555- same = decodedval == int64 (intVal )
557+ same = retkind == reflect .Int64 && decodedval == int64 (origval )
558+ case float32 :
559+ same = retkind == reflect .Float64 && decodedval == float64 (origval )
556560 default :
557561 same = retval == val
558562 }
559- default :
560- same = retval == val
561563 }
562564 if ! same {
563565 t .Error ("Value don't match" , retval , val )
Original file line number Diff line number Diff line change @@ -8,16 +8,16 @@ import (
88
99func TestMakeGoLangScanType (t * testing.T ) {
1010 if (reflect .TypeOf (int64 (0 )) != makeGoLangScanType (typeInfo {TypeId : typeInt8 })) {
11- t .Errorf ("invalid type returned for typeDateTime " )
11+ t .Errorf ("invalid type returned for typeInt8 " )
1212 }
1313 if (reflect .TypeOf (float64 (0 )) != makeGoLangScanType (typeInfo {TypeId : typeFlt4 })) {
14- t .Errorf ("invalid type returned for typeDateTime " )
14+ t .Errorf ("invalid type returned for typeFlt4 " )
1515 }
1616 if (reflect .TypeOf (float64 (0 )) != makeGoLangScanType (typeInfo {TypeId : typeFlt8 })) {
17- t .Errorf ("invalid type returned for typeDateTime " )
17+ t .Errorf ("invalid type returned for typeFlt8 " )
1818 }
1919 if (reflect .TypeOf ("" ) != makeGoLangScanType (typeInfo {TypeId : typeVarChar })) {
20- t .Errorf ("invalid type returned for typeDateTime " )
20+ t .Errorf ("invalid type returned for typeVarChar " )
2121 }
2222 if (reflect .TypeOf (time.Time {}) != makeGoLangScanType (typeInfo {TypeId : typeDateTime })) {
2323 t .Errorf ("invalid type returned for typeDateTime" )
@@ -38,7 +38,7 @@ func TestMakeGoLangScanType(t *testing.T) {
3838 t .Errorf ("invalid type returned for typeIntN" )
3939 }
4040 if (reflect .TypeOf ([]byte {}) != makeGoLangScanType (typeInfo {TypeId : typeMoney , Size : 8 })) {
41- t .Errorf ("invalid type returned for typeIntN " )
41+ t .Errorf ("invalid type returned for typeMoney " )
4242 }
4343}
4444
You can’t perform that action at this time.
0 commit comments