forked from mirror/go-sqlite3
TestQueryer: actually check Rows returned
Fixes a test which did not correctly exercise the multi-statement Queryer functionality
This commit is contained in:
parent
a2e94c9d58
commit
f1eef49b3f
|
@ -1080,17 +1080,19 @@ func TestQueryer(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
n := 1
|
n := 1
|
||||||
if rows != nil {
|
for rows.Next() {
|
||||||
for rows.Next() {
|
var id int
|
||||||
var id int
|
err = rows.Scan(&id)
|
||||||
err = rows.Scan(&id)
|
if err != nil {
|
||||||
if err != nil {
|
t.Error("Failed to db.Query:", err)
|
||||||
t.Error("Failed to db.Query:", err)
|
|
||||||
}
|
|
||||||
if id != n {
|
|
||||||
t.Error("Failed to db.Query: not matched results")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue