...

Source file src/github.com/DATA-DOG/go-sqlmock/rows_go13_test.go

Documentation: github.com/DATA-DOG/go-sqlmock

     1  // +build go1.3
     2  
     3  package sqlmock
     4  
     5  import (
     6  	"database/sql"
     7  	"testing"
     8  )
     9  
    10  func TestQueryRowBytesNotInvalidatedByNext_stringIntoRawBytes(t *testing.T) {
    11  	t.Parallel()
    12  	rows := NewRows([]string{"raw"}).
    13  		AddRow(`one binary value with some text!`).
    14  		AddRow(`two binary value with even more text than the first one`)
    15  	scan := func(rs *sql.Rows) ([]byte, error) {
    16  		var raw sql.RawBytes
    17  		return raw, rs.Scan(&raw)
    18  	}
    19  	want := [][]byte{[]byte(`one binary value with some text!`), []byte(`two binary value with even more text than the first one`)}
    20  	queryRowBytesNotInvalidatedByNext(t, rows, scan, want)
    21  }
    22  
    23  func TestQueryRowBytesNotInvalidatedByClose_stringIntoRawBytes(t *testing.T) {
    24  	t.Parallel()
    25  	rows := NewRows([]string{"raw"}).AddRow(`one binary value with some text!`)
    26  	scan := func(rs *sql.Rows) ([]byte, error) {
    27  		var raw sql.RawBytes
    28  		return raw, rs.Scan(&raw)
    29  	}
    30  	queryRowBytesNotInvalidatedByClose(t, rows, scan, []byte(`one binary value with some text!`))
    31  }
    32  

View as plain text