Skip to content

Commit

Permalink
Merge pull request #81 from fishyww/fixes-pointer-field-panic
Browse files Browse the repository at this point in the history
test issue_78
  • Loading branch information
inhere committed Jan 19, 2021
2 parents f1fe33b + 9fc2b13 commit 2e6691d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions issues_test.go
Expand Up @@ -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...")
}
}

0 comments on commit 2e6691d

Please sign in to comment.