You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When scanning a row into an invalid type such as a string into an int an error should be returned. As of v3.40 and later the error is being ignored. It looks like it may be due to the error being ignored rather than returned here: https://github.com/pashagolub/pgxmock/blob/master/rows.go#L50
To Reproduce
import (
"context""github.com/pashagolub/pgxmock/v3""github.com/stretchr/testify/assert""testing"
)
funcTest_QueryScanProblem(t*testing.T) {
mockSql, _:=pgxmock.NewPool()
ctx:=context.Background()
mockSql.ExpectQuery(`select id from example_table limit 1`).WillReturnRows(
mockSql.NewRows([]string{"seq"}).AddRow("not-an-int"),
)
row:=mockSql.QueryRow(ctx, `select id from example_table limit 1`)
varexpectedIntinterr:=row.Scan(&expectedInt)
assert.ErrorContains(t, err, "Destination kind 'int' not supported for value kind")
}
Describe the bug
When scanning a row into an invalid type such as a string into an int an error should be returned. As of v3.40 and later the error is being ignored. It looks like it may be due to the error being ignored rather than returned here: https://github.com/pashagolub/pgxmock/blob/master/rows.go#L50
To Reproduce
Expected behavior
The error triggered here: https://github.com/pashagolub/pgxmock/blob/master/rows.go#L142 should be returned instead of a nil error.
The text was updated successfully, but these errors were encountered: