Add clean-up for testcase TestDB_CopyIn
This commit is contained in:
parent
432181e1f0
commit
8355eb2fc2
14
main_test.go
14
main_test.go
@ -1067,7 +1067,17 @@ func TestDB_DataSource(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
func TestDB_CopyIn(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)
|
var args = make([][]interface{}, 0)
|
||||||
args = append(args, []interface{}{
|
args = append(args, []interface{}{
|
||||||
"tom", 9,
|
"tom", 9,
|
||||||
@ -1076,7 +1086,7 @@ func TestDB_CopyIn(t *testing.T) {
|
|||||||
}, []interface{}{
|
}, []interface{}{
|
||||||
"jim", 11,
|
"jim", 11,
|
||||||
})
|
})
|
||||||
e := DB.CopyIn(true, "example", args, "name", "age")
|
e = DB.CopyIn(true, "example", args, "name", "age")
|
||||||
if e != nil {
|
if e != nil {
|
||||||
t.Fatal(e.Error())
|
t.Fatal(e.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user