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-27 18:53:23 +02:00
parent 00c33d9c23
commit a1b4816759
193 changed files with 3026 additions and 3387 deletions

View file

@ -352,78 +352,39 @@ describe "String#dump" do
].should be_computed_by(:dump)
end
ruby_version_is ''...'2.4' do
it "returns a string with multi-byte UTF-8 characters replaced by \\u{} notation with lower-case hex digits" do
[ [0200.chr('utf-8'), '"\u{80}"'],
[0201.chr('utf-8'), '"\u{81}"'],
[0202.chr('utf-8'), '"\u{82}"'],
[0203.chr('utf-8'), '"\u{83}"'],
[0204.chr('utf-8'), '"\u{84}"'],
[0206.chr('utf-8'), '"\u{86}"'],
[0207.chr('utf-8'), '"\u{87}"'],
[0210.chr('utf-8'), '"\u{88}"'],
[0211.chr('utf-8'), '"\u{89}"'],
[0212.chr('utf-8'), '"\u{8a}"'],
[0213.chr('utf-8'), '"\u{8b}"'],
[0214.chr('utf-8'), '"\u{8c}"'],
[0215.chr('utf-8'), '"\u{8d}"'],
[0216.chr('utf-8'), '"\u{8e}"'],
[0217.chr('utf-8'), '"\u{8f}"'],
[0220.chr('utf-8'), '"\u{90}"'],
[0221.chr('utf-8'), '"\u{91}"'],
[0222.chr('utf-8'), '"\u{92}"'],
[0223.chr('utf-8'), '"\u{93}"'],
[0224.chr('utf-8'), '"\u{94}"'],
[0225.chr('utf-8'), '"\u{95}"'],
[0226.chr('utf-8'), '"\u{96}"'],
[0227.chr('utf-8'), '"\u{97}"'],
[0230.chr('utf-8'), '"\u{98}"'],
[0231.chr('utf-8'), '"\u{99}"'],
[0232.chr('utf-8'), '"\u{9a}"'],
[0233.chr('utf-8'), '"\u{9b}"'],
[0234.chr('utf-8'), '"\u{9c}"'],
[0235.chr('utf-8'), '"\u{9d}"'],
[0236.chr('utf-8'), '"\u{9e}"'],
[0237.chr('utf-8'), '"\u{9f}"'],
].should be_computed_by(:dump)
end
end
ruby_version_is '2.4' do
it "returns a string with multi-byte UTF-8 characters replaced by \\u{} notation with upper-case hex digits" do
[ [0200.chr('utf-8'), '"\u0080"'],
[0201.chr('utf-8'), '"\u0081"'],
[0202.chr('utf-8'), '"\u0082"'],
[0203.chr('utf-8'), '"\u0083"'],
[0204.chr('utf-8'), '"\u0084"'],
[0206.chr('utf-8'), '"\u0086"'],
[0207.chr('utf-8'), '"\u0087"'],
[0210.chr('utf-8'), '"\u0088"'],
[0211.chr('utf-8'), '"\u0089"'],
[0212.chr('utf-8'), '"\u008A"'],
[0213.chr('utf-8'), '"\u008B"'],
[0214.chr('utf-8'), '"\u008C"'],
[0215.chr('utf-8'), '"\u008D"'],
[0216.chr('utf-8'), '"\u008E"'],
[0217.chr('utf-8'), '"\u008F"'],
[0220.chr('utf-8'), '"\u0090"'],
[0221.chr('utf-8'), '"\u0091"'],
[0222.chr('utf-8'), '"\u0092"'],
[0223.chr('utf-8'), '"\u0093"'],
[0224.chr('utf-8'), '"\u0094"'],
[0225.chr('utf-8'), '"\u0095"'],
[0226.chr('utf-8'), '"\u0096"'],
[0227.chr('utf-8'), '"\u0097"'],
[0230.chr('utf-8'), '"\u0098"'],
[0231.chr('utf-8'), '"\u0099"'],
[0232.chr('utf-8'), '"\u009A"'],
[0233.chr('utf-8'), '"\u009B"'],
[0234.chr('utf-8'), '"\u009C"'],
[0235.chr('utf-8'), '"\u009D"'],
[0236.chr('utf-8'), '"\u009E"'],
[0237.chr('utf-8'), '"\u009F"'],
].should be_computed_by(:dump)
end
it "returns a string with multi-byte UTF-8 characters replaced by \\u{} notation with upper-case hex digits" do
[ [0200.chr('utf-8'), '"\u0080"'],
[0201.chr('utf-8'), '"\u0081"'],
[0202.chr('utf-8'), '"\u0082"'],
[0203.chr('utf-8'), '"\u0083"'],
[0204.chr('utf-8'), '"\u0084"'],
[0206.chr('utf-8'), '"\u0086"'],
[0207.chr('utf-8'), '"\u0087"'],
[0210.chr('utf-8'), '"\u0088"'],
[0211.chr('utf-8'), '"\u0089"'],
[0212.chr('utf-8'), '"\u008A"'],
[0213.chr('utf-8'), '"\u008B"'],
[0214.chr('utf-8'), '"\u008C"'],
[0215.chr('utf-8'), '"\u008D"'],
[0216.chr('utf-8'), '"\u008E"'],
[0217.chr('utf-8'), '"\u008F"'],
[0220.chr('utf-8'), '"\u0090"'],
[0221.chr('utf-8'), '"\u0091"'],
[0222.chr('utf-8'), '"\u0092"'],
[0223.chr('utf-8'), '"\u0093"'],
[0224.chr('utf-8'), '"\u0094"'],
[0225.chr('utf-8'), '"\u0095"'],
[0226.chr('utf-8'), '"\u0096"'],
[0227.chr('utf-8'), '"\u0097"'],
[0230.chr('utf-8'), '"\u0098"'],
[0231.chr('utf-8'), '"\u0099"'],
[0232.chr('utf-8'), '"\u009A"'],
[0233.chr('utf-8'), '"\u009B"'],
[0234.chr('utf-8'), '"\u009C"'],
[0235.chr('utf-8'), '"\u009D"'],
[0236.chr('utf-8'), '"\u009E"'],
[0237.chr('utf-8'), '"\u009F"'],
].should be_computed_by(:dump)
end
it "includes .force_encoding(name) if the encoding isn't ASCII compatible" do