diff --git a/main_test.go b/main_test.go index ad142f91..dbcd8621 100644 --- a/main_test.go +++ b/main_test.go @@ -1067,7 +1067,17 @@ func TestDB_DataSource(t *testing.T) { } func TestDB_CopyIn(t *testing.T) { - DB.Exec("create table if not exists example(name varchar, age integer)") + e:=DB.Exec("create table if not exists example(name varchar, age integer)").Error + defer func(){ + er := DB.Exec("drop table if exists example").Error + if er != nil { + t.Fatal(e.Error()) + } + }() + if e != nil { + t.Fatal(e.Error()) + } + defer DB.Exec("drop table") var args = make([][]interface{}, 0) args = append(args, []interface{}{ "tom", 9, @@ -1076,7 +1086,7 @@ func TestDB_CopyIn(t *testing.T) { }, []interface{}{ "jim", 11, }) - e := DB.CopyIn(true, "example", args, "name", "age") + e = DB.CopyIn(true, "example", args, "name", "age") if e != nil { t.Fatal(e.Error()) }