Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1622)

Unified Diff: src/pkg/exp/sql/sql_test.go

Issue 5530068: code review 5530068: exp/sql: close Rows on EOF (Closed)
Patch Set: diff -r f2999ed409ce https://go.googlecode.com/hg Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/exp/sql/sql.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/exp/sql/sql_test.go
===================================================================
--- a/src/pkg/exp/sql/sql_test.go
+++ b/src/pkg/exp/sql/sql_test.go
@@ -10,8 +10,10 @@
"testing"
)
+const fakeDBName = "foo"
+
func newTestDB(t *testing.T, name string) *DB {
- db, err := Open("test", "foo")
+ db, err := Open("test", fakeDBName)
if err != nil {
t.Fatalf("Open: %v", err)
}
@@ -73,6 +75,12 @@
if !reflect.DeepEqual(got, want) {
t.Logf(" got: %#v\nwant: %#v", got, want)
}
+
+ // And verify that the final rows.Next() call, which hit EOF,
+ // also closed the rows connection.
+ if n := len(db.freeConn); n != 1 {
+ t.Errorf("free conns after query hitting EOF = %d; want 1", n)
+ }
}
func TestRowsColumns(t *testing.T) {
« no previous file with comments | « src/pkg/exp/sql/sql.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b