mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:30:56 +00:00
orm: add test case for insert specified value to auto field
This commit is contained in:
parent
1786b16e61
commit
8f70df6c7b
@ -2013,3 +2013,24 @@ func TestIntegerPk(t *testing.T) {
|
||||
throwFail(t, AssertIs(out.Value, intPk.Value))
|
||||
}
|
||||
}
|
||||
|
||||
func TestInsertAuto(t *testing.T) {
|
||||
u := &User{
|
||||
UserName: "autoPre",
|
||||
Email: "autoPre@gmail.com",
|
||||
}
|
||||
|
||||
id, err := dORM.Insert(u)
|
||||
throwFail(t, err)
|
||||
|
||||
id += 100
|
||||
su := &User{
|
||||
ID: int(id),
|
||||
UserName: "auto",
|
||||
Email: "auto@gmail.com",
|
||||
}
|
||||
|
||||
sid, err := dORM.Insert(su)
|
||||
throwFail(t, err)
|
||||
throwFail(t, AssertIs(id, sid))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user