Skip to content

Commit 6654e41

Browse files
committed
fix test
1 parent 7133e5d commit 6654e41

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

sqlite3_test.go

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,19 +1424,20 @@ var db *TestDB
14241424
var testTables = []string{"foo", "bar", "t", "bench"}
14251425

14261426
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},
14311432
}
14321433

14331434
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},
14401441
}
14411442

14421443
func (db *TestDB) mustExec(sql string, args ...interface{}) sql.Result {
@@ -1451,9 +1452,9 @@ func (db *TestDB) tearDown() {
14511452
for _, tbl := range testTables {
14521453
switch db.dialect {
14531454
case SQLITE:
1454-
db.Exec("drop table if exists " + tbl)
1455+
db.mustExec("drop table if exists " + tbl)
14551456
case MYSQL, POSTGRESQL:
1456-
db.Exec("drop table if exists " + tbl)
1457+
db.mustExec("drop table if exists " + tbl)
14571458
default:
14581459
db.Fatal("unknown dialect")
14591460
}
@@ -1526,8 +1527,8 @@ func makeBench() {
15261527
}
15271528
}
15281529

1529-
// TestResult is test for result
1530-
func TestResult(t *testing.T) {
1530+
// testResult is test for result
1531+
func testResult(t *testing.T) {
15311532
db.tearDown()
15321533
db.mustExec("create temporary table test (id " + db.serialPK() + ", name varchar(10))")
15331534

@@ -1553,8 +1554,8 @@ func TestResult(t *testing.T) {
15531554
}
15541555
}
15551556

1556-
// TestBlobs is test for blobs
1557-
func TestBlobs(t *testing.T) {
1557+
// testBlobs is test for blobs
1558+
func testBlobs(t *testing.T) {
15581559
db.tearDown()
15591560
var blob = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
15601561
db.mustExec("create table foo (id integer primary key, bar " + db.blobType(16) + ")")
@@ -1580,8 +1581,8 @@ func TestBlobs(t *testing.T) {
15801581
}
15811582
}
15821583

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) {
15851586
if testing.Short() {
15861587
t.Log("skipping in short mode")
15871588
return
@@ -1598,8 +1599,8 @@ func TestManyQueryRow(t *testing.T) {
15981599
}
15991600
}
16001601

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) {
16031604
db.tearDown()
16041605
tx, err := db.Begin()
16051606
if err != nil {
@@ -1637,8 +1638,8 @@ func TestTxQuery(t *testing.T) {
16371638
}
16381639
}
16391640

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) {
16421643
db.tearDown()
16431644
db.mustExec("CREATE TABLE t (count INT)")
16441645
sel, err := db.Prepare("SELECT count FROM t ORDER BY count DESC")
@@ -1683,17 +1684,17 @@ func TestPreparedStmt(t *testing.T) {
16831684
// test -bench but calling Benchmark() from a benchmark test
16841685
// currently hangs go.
16851686

1686-
// BenchmarkExec is benchmark for exec
1687-
func BenchmarkExec(b *testing.B) {
1687+
// benchmarkExec is benchmark for exec
1688+
func benchmarkExec(b *testing.B) {
16881689
for i := 0; i < b.N; i++ {
16891690
if _, err := db.Exec("select 1"); err != nil {
16901691
panic(err)
16911692
}
16921693
}
16931694
}
16941695

1695-
// BenchmarkQuery is benchmark for query
1696-
func BenchmarkQuery(b *testing.B) {
1696+
// benchmarkQuery is benchmark for query
1697+
func benchmarkQuery(b *testing.B) {
16971698
for i := 0; i < b.N; i++ {
16981699
var n sql.NullString
16991700
var i int
@@ -1706,8 +1707,8 @@ func BenchmarkQuery(b *testing.B) {
17061707
}
17071708
}
17081709

1709-
// BenchmarkParams is benchmark for params
1710-
func BenchmarkParams(b *testing.B) {
1710+
// benchmarkParams is benchmark for params
1711+
func benchmarkParams(b *testing.B) {
17111712
for i := 0; i < b.N; i++ {
17121713
var n sql.NullString
17131714
var i int
@@ -1720,8 +1721,8 @@ func BenchmarkParams(b *testing.B) {
17201721
}
17211722
}
17221723

1723-
// BenchmarkStmt is benchmark for statement
1724-
func BenchmarkStmt(b *testing.B) {
1724+
// benchmarkStmt is benchmark for statement
1725+
func benchmarkStmt(b *testing.B) {
17251726
st, err := db.Prepare("select ?, ?, ?, ?")
17261727
if err != nil {
17271728
panic(err)
@@ -1740,8 +1741,8 @@ func BenchmarkStmt(b *testing.B) {
17401741
}
17411742
}
17421743

1743-
// BenchmarkRows is benchmark for rows
1744-
func BenchmarkRows(b *testing.B) {
1744+
// benchmarkRows is benchmark for rows
1745+
func benchmarkRows(b *testing.B) {
17451746
db.once.Do(makeBench)
17461747

17471748
for n := 0; n < b.N; n++ {
@@ -1765,8 +1766,8 @@ func BenchmarkRows(b *testing.B) {
17651766
}
17661767
}
17671768

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) {
17701771
db.once.Do(makeBench)
17711772

17721773
st, err := db.Prepare("select * from bench")

0 commit comments

Comments
 (0)