@@ -1424,19 +1424,20 @@ var db *TestDB
1424
1424
var testTables = []string {"foo" , "bar" , "t" , "bench" }
1425
1425
1426
1426
var tests = []testing.InternalTest {
1427
- {Name : "TestBlobs" , F : TestBlobs },
1428
- {Name : "TestManyQueryRow" , F : TestManyQueryRow },
1429
- {Name : "TestTxQuery" , F : TestTxQuery },
1430
- {Name : "TestPreparedStmt" , F : TestPreparedStmt },
1427
+ {Name : "TestResult" , F : testResult },
1428
+ {Name : "TestBlobs" , F : testBlobs },
1429
+ {Name : "TestManyQueryRow" , F : testManyQueryRow },
1430
+ {Name : "TestTxQuery" , F : testTxQuery },
1431
+ {Name : "TestPreparedStmt" , F : testPreparedStmt },
1431
1432
}
1432
1433
1433
1434
var benchmarks = []testing.InternalBenchmark {
1434
- {Name : "BenchmarkExec" , F : BenchmarkExec },
1435
- {Name : "BenchmarkQuery" , F : BenchmarkQuery },
1436
- {Name : "BenchmarkParams" , F : BenchmarkParams },
1437
- {Name : "BenchmarkStmt" , F : BenchmarkStmt },
1438
- {Name : "BenchmarkRows" , F : BenchmarkRows },
1439
- {Name : "BenchmarkStmtRows" , F : BenchmarkStmtRows },
1435
+ {Name : "BenchmarkExec" , F : benchmarkExec },
1436
+ {Name : "BenchmarkQuery" , F : benchmarkQuery },
1437
+ {Name : "BenchmarkParams" , F : benchmarkParams },
1438
+ {Name : "BenchmarkStmt" , F : benchmarkStmt },
1439
+ {Name : "BenchmarkRows" , F : benchmarkRows },
1440
+ {Name : "BenchmarkStmtRows" , F : benchmarkStmtRows },
1440
1441
}
1441
1442
1442
1443
func (db * TestDB ) mustExec (sql string , args ... interface {}) sql.Result {
@@ -1451,9 +1452,9 @@ func (db *TestDB) tearDown() {
1451
1452
for _ , tbl := range testTables {
1452
1453
switch db .dialect {
1453
1454
case SQLITE :
1454
- db .Exec ("drop table if exists " + tbl )
1455
+ db .mustExec ("drop table if exists " + tbl )
1455
1456
case MYSQL , POSTGRESQL :
1456
- db .Exec ("drop table if exists " + tbl )
1457
+ db .mustExec ("drop table if exists " + tbl )
1457
1458
default :
1458
1459
db .Fatal ("unknown dialect" )
1459
1460
}
@@ -1526,8 +1527,8 @@ func makeBench() {
1526
1527
}
1527
1528
}
1528
1529
1529
- // TestResult is test for result
1530
- func TestResult (t * testing.T ) {
1530
+ // testResult is test for result
1531
+ func testResult (t * testing.T ) {
1531
1532
db .tearDown ()
1532
1533
db .mustExec ("create temporary table test (id " + db .serialPK () + ", name varchar(10))" )
1533
1534
@@ -1553,8 +1554,8 @@ func TestResult(t *testing.T) {
1553
1554
}
1554
1555
}
1555
1556
1556
- // TestBlobs is test for blobs
1557
- func TestBlobs (t * testing.T ) {
1557
+ // testBlobs is test for blobs
1558
+ func testBlobs (t * testing.T ) {
1558
1559
db .tearDown ()
1559
1560
var blob = []byte {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 }
1560
1561
db .mustExec ("create table foo (id integer primary key, bar " + db .blobType (16 ) + ")" )
@@ -1580,8 +1581,8 @@ func TestBlobs(t *testing.T) {
1580
1581
}
1581
1582
}
1582
1583
1583
- // TestManyQueryRow is test for many query row
1584
- func TestManyQueryRow (t * testing.T ) {
1584
+ // testManyQueryRow is test for many query row
1585
+ func testManyQueryRow (t * testing.T ) {
1585
1586
if testing .Short () {
1586
1587
t .Log ("skipping in short mode" )
1587
1588
return
@@ -1598,8 +1599,8 @@ func TestManyQueryRow(t *testing.T) {
1598
1599
}
1599
1600
}
1600
1601
1601
- // TestTxQuery is test for transactional query
1602
- func TestTxQuery (t * testing.T ) {
1602
+ // testTxQuery is test for transactional query
1603
+ func testTxQuery (t * testing.T ) {
1603
1604
db .tearDown ()
1604
1605
tx , err := db .Begin ()
1605
1606
if err != nil {
@@ -1637,8 +1638,8 @@ func TestTxQuery(t *testing.T) {
1637
1638
}
1638
1639
}
1639
1640
1640
- // TestPreparedStmt is test for prepared statement
1641
- func TestPreparedStmt (t * testing.T ) {
1641
+ // testPreparedStmt is test for prepared statement
1642
+ func testPreparedStmt (t * testing.T ) {
1642
1643
db .tearDown ()
1643
1644
db .mustExec ("CREATE TABLE t (count INT)" )
1644
1645
sel , err := db .Prepare ("SELECT count FROM t ORDER BY count DESC" )
@@ -1683,17 +1684,17 @@ func TestPreparedStmt(t *testing.T) {
1683
1684
// test -bench but calling Benchmark() from a benchmark test
1684
1685
// currently hangs go.
1685
1686
1686
- // BenchmarkExec is benchmark for exec
1687
- func BenchmarkExec (b * testing.B ) {
1687
+ // benchmarkExec is benchmark for exec
1688
+ func benchmarkExec (b * testing.B ) {
1688
1689
for i := 0 ; i < b .N ; i ++ {
1689
1690
if _ , err := db .Exec ("select 1" ); err != nil {
1690
1691
panic (err )
1691
1692
}
1692
1693
}
1693
1694
}
1694
1695
1695
- // BenchmarkQuery is benchmark for query
1696
- func BenchmarkQuery (b * testing.B ) {
1696
+ // benchmarkQuery is benchmark for query
1697
+ func benchmarkQuery (b * testing.B ) {
1697
1698
for i := 0 ; i < b .N ; i ++ {
1698
1699
var n sql.NullString
1699
1700
var i int
@@ -1706,8 +1707,8 @@ func BenchmarkQuery(b *testing.B) {
1706
1707
}
1707
1708
}
1708
1709
1709
- // BenchmarkParams is benchmark for params
1710
- func BenchmarkParams (b * testing.B ) {
1710
+ // benchmarkParams is benchmark for params
1711
+ func benchmarkParams (b * testing.B ) {
1711
1712
for i := 0 ; i < b .N ; i ++ {
1712
1713
var n sql.NullString
1713
1714
var i int
@@ -1720,8 +1721,8 @@ func BenchmarkParams(b *testing.B) {
1720
1721
}
1721
1722
}
1722
1723
1723
- // BenchmarkStmt is benchmark for statement
1724
- func BenchmarkStmt (b * testing.B ) {
1724
+ // benchmarkStmt is benchmark for statement
1725
+ func benchmarkStmt (b * testing.B ) {
1725
1726
st , err := db .Prepare ("select ?, ?, ?, ?" )
1726
1727
if err != nil {
1727
1728
panic (err )
@@ -1740,8 +1741,8 @@ func BenchmarkStmt(b *testing.B) {
1740
1741
}
1741
1742
}
1742
1743
1743
- // BenchmarkRows is benchmark for rows
1744
- func BenchmarkRows (b * testing.B ) {
1744
+ // benchmarkRows is benchmark for rows
1745
+ func benchmarkRows (b * testing.B ) {
1745
1746
db .once .Do (makeBench )
1746
1747
1747
1748
for n := 0 ; n < b .N ; n ++ {
@@ -1765,8 +1766,8 @@ func BenchmarkRows(b *testing.B) {
1765
1766
}
1766
1767
}
1767
1768
1768
- // BenchmarkStmtRows is benchmark for statement rows
1769
- func BenchmarkStmtRows (b * testing.B ) {
1769
+ // benchmarkStmtRows is benchmark for statement rows
1770
+ func benchmarkStmtRows (b * testing.B ) {
1770
1771
db .once .Do (makeBench )
1771
1772
1772
1773
st , err := db .Prepare ("select * from bench" )
0 commit comments