[test] add spec for RM-528

This commit is contained in:
Watson
2014-07-06 16:45:55 +09:00
parent 31d4712b67
commit 9e2c129081

View File

@@ -43,3 +43,27 @@ describe "Strings with multibyte characters" do
"..€€……".rindex("").should == 5
end
end
# RM-528
describe "String#getCharacters:range:" do
def get_characters(loc, len)
buf_str = Pointer.new(:ushort, len)
buf_nsstr = Pointer.new(:ushort, len)
@str.getCharacters(buf_str, range:NSMakeRange(loc, len))
@nsstr.getCharacters(buf_nsstr, range:NSMakeRange(loc, len))
len.times do |i|
buf_str[i].should == buf_nsstr[i]
end
end
it " should extract Unicode properly" do
@str = "😄😃😀😊☺️😉😍😘😚😗😙😜😝😛"
@nsstr = NSString.stringWithString(@str)
@str.length.times do |i|
get_characters(i, @str.length - i)
end
end
end