MCPcopy Create free account
hub / github.com/DATA-DOG/go-sqlmock / TestQueryRowBytesInvalidatedByNext_bytesIntoRawBytes

Function TestQueryRowBytesInvalidatedByNext_bytesIntoRawBytes

rows_test.go:313–331  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

311}
312
313func TestQueryRowBytesInvalidatedByNext_bytesIntoRawBytes(t *testing.T) {
314 t.Parallel()
315 replace := []byte(invalid)
316 rows := NewRows([]string{"raw"}).
317 AddRow([]byte(`one binary value with some text!`)).
318 AddRow([]byte(`two binary value with even more text than the first one`))
319 scan := func(rs *sql.Rows) ([]byte, error) {
320 var raw sql.RawBytes
321 return raw, rs.Scan(&raw)
322 }
323 want := []struct {
324 Initial []byte
325 Replaced []byte
326 }{
327 {Initial: []byte(`one binary value with some text!`), Replaced: replace[:len(replace)-7]},
328 {Initial: []byte(`two binary value with even more text than the first one`), Replaced: bytes.Join([][]byte{replace, replace[:len(replace)-23]}, nil)},
329 }
330 queryRowBytesInvalidatedByNext(t, rows, scan, want)
331}
332
333func TestQueryRowBytesNotInvalidatedByNext_bytesIntoBytes(t *testing.T) {
334 t.Parallel()

Callers

nothing calls this directly

Calls 4

NewRowsFunction · 0.85
AddRowMethod · 0.80
ScanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…