mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 11:18:02 +08:00
improve unit testing case for package gdb
This commit is contained in:
parent
8978112433
commit
d2ae383b83
@ -72,9 +72,15 @@ func Test_Update_Raw(t *testing.T) {
|
|||||||
result, err := user.Data(g.Map{
|
result, err := user.Data(g.Map{
|
||||||
"id": gdb.Raw("id+100"),
|
"id": gdb.Raw("id+100"),
|
||||||
"create_time": gdb.Raw("now()"),
|
"create_time": gdb.Raw("now()"),
|
||||||
}).Where("id", 1).Insert()
|
}).Where("id", 1).Update()
|
||||||
t.Assert(err, nil)
|
t.Assert(err, nil)
|
||||||
n, _ := result.RowsAffected()
|
n, _ := result.RowsAffected()
|
||||||
t.Assert(n, 1)
|
t.Assert(n, 1)
|
||||||
})
|
})
|
||||||
|
gtest.C(t, func(t *gtest.T) {
|
||||||
|
user := db.Table(table)
|
||||||
|
n, err := user.Where("id", 101).Count()
|
||||||
|
t.Assert(err, nil)
|
||||||
|
t.Assert(n, 1)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user