File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -3183,25 +3183,26 @@ func TestRawBytesAreNotModified(t *testing.T) {
31833183 if err != nil {
31843184 dbt .Fatal (err )
31853185 }
3186+ defer rows .Close ()
31863187
31873188 var b int
31883189 var raw sql.RawBytes
3189- for rows .Next () {
3190- if err := rows .Scan (& b , & raw ); err != nil {
3191- dbt .Fatal (err )
3192- }
3190+ if ! rows .Next () {
3191+ dbt .Fatal ("expected at least one row" )
3192+ }
3193+ if err := rows .Scan (& b , & raw ); err != nil {
3194+ dbt .Fatal (err )
3195+ }
31933196
3194- before := string (raw )
3195- // Ensure cancelling the query does not corrupt the contents of `raw`
3196- cancel ()
3197- time .Sleep (time .Microsecond * 100 )
3198- after := string (raw )
3197+ before := string (raw )
3198+ // Ensure cancelling the query does not corrupt the contents of `raw`
3199+ cancel ()
3200+ time .Sleep (time .Microsecond * 100 )
3201+ after := string (raw )
31993202
3200- if before != after {
3201- dbt .Fatalf ("the backing storage for sql.RawBytes has been modified (i=%v)" , i )
3202- }
3203+ if before != after {
3204+ dbt .Fatalf ("the backing storage for sql.RawBytes has been modified (i=%v)" , i )
32033205 }
3204- rows .Close ()
32053206 }()
32063207 }
32073208 })
You can’t perform that action at this time.
0 commit comments