From 3879fd9c3409cdcac4ec9683c467c327daf13d6c Mon Sep 17 00:00:00 2001 From: qiantao Date: Thu, 18 Jun 2020 17:25:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 1 - validation/util_test.go | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d7744b33..17d66efa 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,6 @@ module github.com/astaxie/beego require ( github.com/Knetic/govaluate v3.0.0+incompatible // indirect - github.com/OwnLocal/goes v1.0.0 github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542 github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737 diff --git a/validation/util_test.go b/validation/util_test.go index 05f4ec3e..e47483f1 100644 --- a/validation/util_test.go +++ b/validation/util_test.go @@ -83,8 +83,8 @@ func TestGetValidFuncs(t *testing.T) { type User struct { Name string `valid:"Required;MaxSize(5)" ` - Sex string `valid:"Required;" label:"sex_label"` - Age int `valid:"Required;Range(1, 140);" label:"age_label"` + Sex string `valid:"Required;"label:"sex_label"` + Age int `valid:"Required;Range(1, 140);"label:"age_label"` } func TestValidation(t *testing.T) { @@ -100,6 +100,11 @@ func TestValidation(t *testing.T) { for _, err := range valid.Errors { log.Println(err.Key, err.Message) } + if len(valid.Errors) != 3 { + t.Error("must be has 3 error") + } + } else { + t.Error("must be has 3 error") } }