mirror of https://github.com/v2ray/v2ray-core
value receiver for StringList.Len()
parent
89a876a6d4
commit
933e244d92
|
@ -7,6 +7,6 @@ func NewStringList(raw []string) *StringList {
|
||||||
return &list
|
return &list
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *StringList) Len() int {
|
func (this StringList) Len() int {
|
||||||
return len(*this)
|
return len(this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,3 +18,13 @@ func TestStringListUnmarshalError(t *testing.T) {
|
||||||
err := json.Unmarshal([]byte(rawJson), list)
|
err := json.Unmarshal([]byte(rawJson), list)
|
||||||
assert.Error(err).IsNotNil()
|
assert.Error(err).IsNotNil()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStringListLen(t *testing.T) {
|
||||||
|
assert := assert.On(t)
|
||||||
|
|
||||||
|
rawJson := `"a, b, c, d"`
|
||||||
|
list := new(StringList)
|
||||||
|
err := json.Unmarshal([]byte(rawJson), list)
|
||||||
|
assert.Error(err).IsNil()
|
||||||
|
assert.Int(list.Len()).Equals(4)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue