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
1 changed files with 21 additions and 0 deletions

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