Skip to content

Commit

Permalink
📝 doc: update some code comment info
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jan 23, 2024
1 parent 4491213 commit 27b33f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ func TestIssues_120(t *testing.T) {
}

// https://github.com/gookit/validate/issues/124
// Validate array/slice items #124
func TestIssue_124(t *testing.T) {
m := map[string]any{
"names": []string{"John", "Jane", "abc"},
Expand Down Expand Up @@ -1268,7 +1269,7 @@ func TestIssues_192(t *testing.T) {
Main1 *struct {
Child11 int `json:"child11" validate:"required"`
Child12 int `json:"child12" validate:"required"`
} `json:"main1" validate:"optional"` // optional sometimes
} `json:"main1" validate:"optional"` // optional - will not validate Main1.* on Main1 is nil

Main2 *struct {
Child21 int `json:"child21" validate:"required"`
Expand Down Expand Up @@ -1296,9 +1297,9 @@ func TestIssues_192(t *testing.T) {
assert.StrContains(t, v.Errors.String(), "main1.child11 is required to not be empty")
})

// set main1 = nil, should not validate Main1.child1
// set main1 = nil, should not validate Main1.*
t.Run("set main1 to nil", func(t *testing.T) {
req.Main1 = nil // TODO 应该不验证child1字段了
req.Main1 = nil // fields under Main1 will not be validated
v := validate.Struct(req)
assert.True(t, v.Validate())
})
Expand Down
4 changes: 4 additions & 0 deletions util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,7 @@ func TestCallByValue_nil_arg(t *testing.T) {
rs := CallByValue(reflect.ValueOf(fn1), nil)
dump.P(rs[0].CanInterface(), rs[0].Interface())
}

func TestFunc_convertArgsType(t *testing.T) {
// TODO add more test case ...
}

0 comments on commit 27b33f1

Please sign in to comment.