aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/exp/sql/sql_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/exp/sql/sql_test.go')
-rw-r--r--src/pkg/exp/sql/sql_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pkg/exp/sql/sql_test.go b/src/pkg/exp/sql/sql_test.go
index 5307a235dd..590bf818fe 100644
--- a/src/pkg/exp/sql/sql_test.go
+++ b/src/pkg/exp/sql/sql_test.go
@@ -10,8 +10,10 @@ import (
"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 @@ func TestQuery(t *testing.T) {
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) {