github.com/bytedance/go-tagexpr@v2.7.5-0.20210114074101-de5b8743ad85+incompatible/binding/tag_names_test.go (about) 1 package binding 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestDefaultSplitTag(t *testing.T) { 10 var cases = []struct { 11 desc string 12 input string 13 expected *tagInfo 14 }{ 15 { 16 desc: "default empty", 17 input: "", 18 expected: &tagInfo{}, 19 }, 20 { 21 desc: "default", 22 input: "a,required", 23 expected: &tagInfo{paramName: "a", required: true}, 24 }, 25 } 26 27 for _, c := range cases { 28 t.Run(c.desc, func(t *testing.T) { 29 assert.Equal(t, c.expected, newTagInfo(c.input, false)) 30 }) 31 } 32 }