From 9fc2b130138bae9ed991b562da7713bfa11f2abb Mon Sep 17 00:00:00 2001 From: fishyww Date: Sat, 16 Jan 2021 10:50:51 +0800 Subject: [PATCH] test issue_78 --- issues_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/issues_test.go b/issues_test.go index aa22748..8b66477 100644 --- a/issues_test.go +++ b/issues_test.go @@ -293,3 +293,26 @@ func TestStructNested(t *testing.T) { assert.False(t, v2.Validate()) } } + +// https://github.com/gookit/validate/issues/78 +func TestIssue78(t *testing.T) { + + type UserDto struct { + Name string `validate:"required"` + Sex *bool `validate:"required"` + } + + //sex := true + u := UserDto{ + Name: "abc", + Sex: nil, + } + + // 创建 Validation 实例 + v := Struct(&u) + if !v.Validate() { + fmt.Println(v.Errors) + } else { + fmt.Println("Success...") + } +}