1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-26 03:11:30 +00:00

orm: add test case for insert specified value to auto field

This commit is contained in:
miraclesu 2016-03-23 20:28:22 +08:00
parent 1786b16e61
commit 8f70df6c7b

View File

@ -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))
}