Commit 8f70df6c authored by miraclesu's avatar miraclesu

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

parent 1786b16e
...@@ -2013,3 +2013,24 @@ func TestIntegerPk(t *testing.T) { ...@@ -2013,3 +2013,24 @@ func TestIntegerPk(t *testing.T) {
throwFail(t, AssertIs(out.Value, intPk.Value)) 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))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment