1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-04-28 23:20:11 +02:00
parent 994833085a
commit 79671ec57e
135 changed files with 4415 additions and 4885 deletions

View file

@ -10,19 +10,17 @@ describe :string_length, shared: true do
"four".send(@method).should == 4
end
with_feature :encoding do
it "returns the length of a string in different encodings" do
utf8_str = 'こにちわ' * 100
utf8_str.size.should == 400
utf8_str.encode(Encoding::UTF_32BE).size.should == 400
utf8_str.encode(Encoding::SHIFT_JIS).size.should == 400
end
it "returns the length of a string in different encodings" do
utf8_str = 'こにちわ' * 100
utf8_str.size.should == 400
utf8_str.encode(Encoding::UTF_32BE).size.should == 400
utf8_str.encode(Encoding::SHIFT_JIS).size.should == 400
end
it "returns the length of the new self after encoding is changed" do
str = 'こにちわ'
str.send(@method)
it "returns the length of the new self after encoding is changed" do
str = 'こにちわ'
str.send(@method)
str.force_encoding('ASCII-8BIT').send(@method).should == 12
end
str.force_encoding('ASCII-8BIT').send(@method).should == 12
end
end