add tests for afterinsert

This commit is contained in:
Lunny Xiao 2017-10-24 14:59:53 +08:00
parent fbf62a9711
commit c25d5751f6
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 19 additions and 0 deletions

View File

@ -1029,3 +1029,22 @@ func TestAfterLoadProcessor(t *testing.T) {
assert.NoError(t, bs[i].Err)
}
}
type AfterInsertStruct struct {
Id int64
}
func (a *AfterInsertStruct) AftertInsert(bean interface{}) {
if a.Id != 0 {
panic("a.Id")
}
}
func TestAfterInsert(t *testing.T) {
assert.NoError(t, prepareEngine())
assertSync(t, new(AfterInsertStruct))
_, err := testEngine.Insert(&AfterInsertStruct{})
assert.NoError(t, err)
}