File tree 1 file changed +28
-0
lines changed 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -499,6 +499,34 @@ func TestString(t *testing.T) {
499
499
})
500
500
}
501
501
502
+ func TestRawBytes (t * testing.T ) {
503
+ runTests (t , dsn , func (dbt * DBTest ) {
504
+ v1 := []byte ("aaa" )
505
+ v2 := []byte ("bbb" )
506
+ rows := dbt .mustQuery ("SELECT ?, ?" , v1 , v2 )
507
+ if rows .Next () {
508
+ var o1 , o2 sql.RawBytes
509
+ if err := rows .Scan (& o1 , & o2 ); err != nil {
510
+ dbt .Errorf ("Got error: %v" , err )
511
+ }
512
+ if ! bytes .Equal (v1 , o1 ) {
513
+ dbt .Errorf ("expected %v, got %v" , v1 , o1 )
514
+ }
515
+ if ! bytes .Equal (v2 , o2 ) {
516
+ dbt .Errorf ("expected %v, got %v" , v2 , o2 )
517
+ }
518
+ // https://github.com/go-sql-driver/mysql/issues/765
519
+ // Appending to RawBytes shouldn't overwrite next RawBytes.
520
+ o1 = append (o1 , "xyzzy" ... )
521
+ if ! bytes .Equal (v2 , o2 ) {
522
+ dbt .Errorf ("expected %v, got %v" , v2 , o2 )
523
+ }
524
+ } else {
525
+ dbt .Errorf ("no data" )
526
+ }
527
+ })
528
+ }
529
+
502
530
type testValuer struct {
503
531
value string
504
532
}
You can’t perform that action at this time.
0 commit comments