aboutsummaryrefslogtreecommitdiff
path: root/sqlite3_test/sqltest.go
diff options
context:
space:
mode:
authorPhilip O'Toole <philip.otoole@yahoo.com>2016-02-23 01:18:14 -0500
committerPhilip O'Toole <philip.otoole@yahoo.com>2016-02-23 01:18:14 -0500
commit3e97a4ca68500045276a2ba7051740bd53e40d06 (patch)
treed984cc8023dffd95fd37fc6ed293ba80f973592a /sqlite3_test/sqltest.go
parentMerge pull request #134 from antoine-lizee/patch-1 (diff)
parentMerge pull request #267 from ianlancetaylor/go16 (diff)
downloadgolite-3e97a4ca68500045276a2ba7051740bd53e40d06.tar.gz
golite-3e97a4ca68500045276a2ba7051740bd53e40d06.tar.xz
Merge pull request #1 from mattn/master
Bring master up-to-date
Diffstat (limited to 'sqlite3_test/sqltest.go')
-rw-r--r--sqlite3_test/sqltest.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/sqlite3_test/sqltest.go b/sqlite3_test/sqltest.go
index fc82782..84b65d9 100644
--- a/sqlite3_test/sqltest.go
+++ b/sqlite3_test/sqltest.go
@@ -275,12 +275,11 @@ func TestPreparedStmt(t *testing.T) {
}
const nRuns = 10
- ch := make(chan bool)
+ var wg sync.WaitGroup
for i := 0; i < nRuns; i++ {
+ wg.Add(1)
go func() {
- defer func() {
- ch <- true
- }()
+ defer wg.Done()
for j := 0; j < 10; j++ {
count := 0
if err := sel.QueryRow().Scan(&count); err != nil && err != sql.ErrNoRows {
@@ -294,9 +293,7 @@ func TestPreparedStmt(t *testing.T) {
}
}()
}
- for i := 0; i < nRuns; i++ {
- <-ch
- }
+ wg.Wait()
}
// Benchmarks need to use panic() since b.Error errors are lost when
@@ -318,7 +315,7 @@ func BenchmarkQuery(b *testing.B) {
var i int
var f float64
var s string
-// var t time.Time
+ // var t time.Time
if err := db.QueryRow("select null, 1, 1.1, 'foo'").Scan(&n, &i, &f, &s); err != nil {
panic(err)
}
@@ -331,7 +328,7 @@ func BenchmarkParams(b *testing.B) {
var i int
var f float64
var s string
-// var t time.Time
+ // var t time.Time
if err := db.QueryRow("select ?, ?, ?, ?", nil, 1, 1.1, "foo").Scan(&n, &i, &f, &s); err != nil {
panic(err)
}
@@ -350,7 +347,7 @@ func BenchmarkStmt(b *testing.B) {
var i int
var f float64
var s string
-// var t time.Time
+ // var t time.Time
if err := st.QueryRow(nil, 1, 1.1, "foo").Scan(&n, &i, &f, &s); err != nil {
panic(err)
}