mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
value receiver for StringList.Len()
This commit is contained in:
parent
89a876a6d4
commit
933e244d92
@ -7,6 +7,6 @@ func NewStringList(raw []string) *StringList {
|
||||
return &list
|
||||
}
|
||||
|
||||
func (this *StringList) Len() int {
|
||||
return len(*this)
|
||||
func (this StringList) Len() int {
|
||||
return len(this)
|
||||
}
|
||||
|
@ -18,3 +18,13 @@ func TestStringListUnmarshalError(t *testing.T) {
|
||||
err := json.Unmarshal([]byte(rawJson), list)
|
||||
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
Block a user