add test for get slice (#619)

This commit is contained in:
Lunny Xiao 2017-06-15 10:12:30 +08:00 committed by GitHub
parent f86679d536
commit eb52e0e4ae
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)
}