Skip to content

Commit

Permalink
Update validator_test.go
Browse files Browse the repository at this point in the history
Change-Id: I5b57a2235e3891813bd39399d0063ba1b83ce42f
  • Loading branch information
andeya committed Jan 14, 2021
1 parent 76186ec commit de5b874
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"encoding/json"
"testing"

vd "github.com/bytedance/go-tagexpr/validator"
"github.com/stretchr/testify/assert"

vd "github.com/bytedance/go-tagexpr/validator"
)

func TestNil(t *testing.T) {
Expand Down Expand Up @@ -202,3 +203,20 @@ func TestIn(t *testing.T) {
err = v.Validate(data3)
assert.EqualError(t, err, "[1] range exceeded")
}

type (
Issue23A struct {
b *Issue23B
v int64 `vd:"$==0"`
}
Issue23B struct {
a *Issue23A
v int64 `vd:"$==0"`
}
)

func TestIssue23(t *testing.T) {
var data = &Issue23B{a: &Issue23A{b: new(Issue23B)}}
err := vd.Validate(data, true)
assert.NoError(t, err)
}

0 comments on commit de5b874

Please sign in to comment.