add test for get slice

This commit is contained in:
Lunny Xiao 2017-06-15 10:07:14 +08:00
parent f86679d536
commit a13519444e
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 16 additions and 0 deletions

View File

@ -155,3 +155,19 @@ func TestGetStruct(t *testing.T) {
assert.NoError(t, err)
assert.True(t, has)
}
func TestGetSlice(t *testing.T) {
assert.NoError(t, prepareEngine())
type UserinfoSlice struct {
Uid int `xorm:"pk autoincr"`
IsMan bool
}
assertSync(t, new(UserinfoSlice))
var users []UserinfoSlice
has, err := testEngine.Get(&users)
assert.False(t, has)
assert.Error(t, err)
}