mirror of
https://github.com/MontFerret/ferret.git
synced 2025-03-05 15:16:07 +02:00
parent
eb523f01cc
commit
14dd7ac40b
@ -106,7 +106,7 @@ func (t String) Copy() core.Value {
|
||||
}
|
||||
|
||||
func (t String) Length() Int {
|
||||
return Int(len(t))
|
||||
return Int(len([]rune(string(t))))
|
||||
}
|
||||
|
||||
func (t String) Contains(other String) Boolean {
|
||||
|
@ -26,4 +26,12 @@ func TestString(t *testing.T) {
|
||||
So(v.Hash(), ShouldEqual, v.Hash())
|
||||
})
|
||||
})
|
||||
|
||||
Convey(".Length", t, func() {
|
||||
Convey("Should return unicode length", func() {
|
||||
str := values.NewString("Спутник")
|
||||
|
||||
So(str.Length(), ShouldEqual, 7)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user