1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-03 16:30:19 +00:00
This commit is contained in:
slene
2013-09-22 19:20:40 +08:00
parent 09aca2528a
commit 001e33f310
3 changed files with 17 additions and 2 deletions

View File

@ -745,6 +745,17 @@ func TestRelatedSel(t *testing.T) {
num, err = qs.Filter("user__username", "slene").Count()
throwFail(t, err)
throwFail(t, AssertIs(num, 1))
var posts []*Post
qs = dORM.QueryTable("post")
num, err = qs.RelatedSel().All(&posts)
throwFail(t, err)
throwFailNow(t, AssertIs(num, 4))
throwFailNow(t, AssertIs(posts[0].User.UserName, "slene"))
throwFailNow(t, AssertIs(posts[1].User.UserName, "astaxie"))
throwFailNow(t, AssertIs(posts[2].User.UserName, "astaxie"))
throwFailNow(t, AssertIs(posts[3].User.UserName, "nobody"))
}
func TestSetCond(t *testing.T) {