Skip to content

Commit

Permalink
TestQueryer: actually check Rows returned
Browse files Browse the repository at this point in the history
Fixes a test which did not correctly exercise the multi-statement
Queryer functionality
  • Loading branch information
ohwgiles authored and mattn committed Aug 16, 2022
1 parent a2e94c9 commit f1eef49
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions sqlite3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1080,17 +1080,19 @@ func TestQueryer(t *testing.T) {
}
defer rows.Close()
n := 1
if rows != nil {
for rows.Next() {
var id int
err = rows.Scan(&id)
if err != nil {
t.Error("Failed to db.Query:", err)
}
if id != n {
t.Error("Failed to db.Query: not matched results")
}
for rows.Next() {
var id int
err = rows.Scan(&id)
if err != nil {
t.Error("Failed to db.Query:", err)
}
if id != n {
t.Error("Failed to db.Query: not matched results")
}
n = n + 1
}
if n != 3 {
t.Errorf("Expected 3 rows but retrieved %v", n-1)
}
}

Expand Down

0 comments on commit f1eef49

Please sign in to comment.