1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-10 02:20:19 +00:00

add struct tag support

This commit is contained in:
miraclesu
2013-07-24 12:20:42 +08:00
parent 4c6163baa0
commit 92db56c0cb
4 changed files with 78 additions and 30 deletions

View File

@ -67,7 +67,10 @@ func TestCall(t *testing.T) {
t.Fatal(err)
}
valid := &Validation{}
funcs.Call(vfs[1].Name, valid, u.Age, vfs[1].Params[0], vfs[1].Params[1], vfs[1].Name)
vfs[1].Params = append([]interface{}{valid, u.Age}, vfs[1].Params...)
if _, err = funcs.Call(vfs[1].Name, vfs[1].Params...); err != nil {
t.Fatal(err)
}
if len(valid.Errors) != 1 {
t.Error("age out of range should be has an error")
}