File tree 1 file changed +14
-13
lines changed
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) {
3183
3183
if err != nil {
3184
3184
dbt .Fatal (err )
3185
3185
}
3186
+ defer rows .Close ()
3186
3187
3187
3188
var b int
3188
3189
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
+ }
3193
3196
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 )
3199
3202
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 )
3203
3205
}
3204
- rows .Close ()
3205
3206
}()
3206
3207
}
3207
3208
})
You can’t perform that action at this time.
0 commit comments