mirror of
https://github.com/MontFerret/ferret.git
synced 2025-11-06 08:39:09 +02:00
@@ -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)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user