Skip to content

Commit

Permalink
in test, close rows and use assert helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
GregOwen committed Dec 5, 2023
1 parent bf55c83 commit 8ac2238
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions statement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,19 +840,13 @@ func TestWithQueryTag(t *testing.T) {
rows := dbt.mustQueryContext(
ctx,
"SELECT QUERY_TAG FROM table(information_schema.query_history_by_session())")
if !rows.Next() {
t.Fatal("no rows")
}
defer rows.Close()

assertTrueF(t, rows.Next())
var tag sql.NullString
err := rows.Scan(&tag)
if err != nil {
t.Error(err)
}
if !tag.Valid {
t.Fatal("no tag set")
}
if tag.String != testQueryTag {
t.Fatalf("expected tag '%s' but got '%s'", testQueryTag, tag.String)
}
assertNilF(t, err)
assertTrueF(t, tag.Valid, "no QUERY_TAG set")
assertEqualF(t, tag.String, testQueryTag)
})
}

0 comments on commit 8ac2238

Please sign in to comment.