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-06-27 21:02:36 +02:00
parent c940397116
commit d80e44deec
157 changed files with 581 additions and 543 deletions

View file

@ -125,13 +125,13 @@ describe "String#encoding for Strings with \\x escapes" do
s.encoding.should == Encoding::US_ASCII
end
it "returns ASCII-8BIT when an escape creates a byte with the 8th bit set if the source encoding is US-ASCII" do
it "returns BINARY when an escape creates a byte with the 8th bit set if the source encoding is US-ASCII" do
__ENCODING__.should == Encoding::US_ASCII
str = " "
str.encoding.should == Encoding::US_ASCII
str += [0xDF].pack('C')
str.ascii_only?.should be_false
str.encoding.should == Encoding::ASCII_8BIT
str.encoding.should == Encoding::BINARY
end
# TODO: Deal with case when the byte in question isn't valid in the source
@ -155,7 +155,7 @@ describe "String#encoding for Strings with \\x escapes" do
default_external = Encoding.default_external
Encoding.default_external = Encoding::SHIFT_JIS
"\x50".encoding.should == Encoding::US_ASCII
[0xD4].pack('C').encoding.should == Encoding::ASCII_8BIT
[0xD4].pack('C').encoding.should == Encoding::BINARY
Encoding.default_external = default_external
end
@ -166,7 +166,7 @@ describe "String#encoding for Strings with \\x escapes" do
Encoding.default_external = Encoding::SHIFT_JIS
x50 = "\x50"
x50.encoding.should == Encoding::US_ASCII
[0xD4].pack('C').encoding.should == Encoding::ASCII_8BIT
[0xD4].pack('C').encoding.should == Encoding::BINARY
Encoding.default_external = default_external
Encoding.default_internal = default_internal
end