From e36e29f33ebc2416e706493755e136018be1df52 Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 15 Nov 2011 10:41:43 +0900 Subject: [PATCH] fix test. --- sqlite3_test.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sqlite3_test.go b/sqlite3_test.go index bb49109..c46c2e3 100644 --- a/sqlite3_test.go +++ b/sqlite3_test.go @@ -15,9 +15,10 @@ func TestOpen(t *testing.T) { } defer os.Remove("./foo.db") + _, err = db.Exec("drop table foo") _, err = db.Exec("create table foo (id integer)") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to create table:", err) return } @@ -34,15 +35,16 @@ func TestInsert(t *testing.T) { } defer os.Remove("./foo.db") + _, err = db.Exec("drop table foo") _, err = db.Exec("create table foo (id integer)") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to create table:", err) return } _, err = db.Exec("insert into foo(id) values(123)") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to insert record:", err) return } @@ -70,21 +72,22 @@ func TestUpdate(t *testing.T) { } defer os.Remove("./foo.db") + _, err = db.Exec("drop table foo") _, err = db.Exec("create table foo (id integer)") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to create table:", err) return } _, err = db.Exec("insert into foo(id) values(123)") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to insert record:", err) return } _, err = db.Exec("update foo set id = 234") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to update record:", err) return } @@ -112,21 +115,22 @@ func TestDelete(t *testing.T) { } defer os.Remove("./foo.db") + _, err = db.Exec("drop table foo") _, err = db.Exec("create table foo (id integer)") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to create table:", err) return } _, err = db.Exec("insert into foo(id) values(123)") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to insert record:", err) return } _, err = db.Exec("delete from foo where id = 123") if err != nil { - t.Errorf("Failed to create table") + t.Errorf("Failed to delete record:", err) return }