aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/tr_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-04-28 23:20:11 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-04-28 23:20:11 +0200
commit79671ec57e59091260a0bc3d40a31d31d9c72a94 (patch)
tree2f59a8727b8f63f9e79d50352fa4f78a7cc00234 /spec/ruby/core/string/tr_spec.rb
parent994833085ae06afbe94d30ab183d80e0234fbe14 (diff)
downloadruby-79671ec57e59091260a0bc3d40a31d31d9c72a94.tar.gz
Update to ruby/spec@7de852d
Diffstat (limited to 'spec/ruby/core/string/tr_spec.rb')
-rw-r--r--spec/ruby/core/string/tr_spec.rb44
1 files changed, 21 insertions, 23 deletions
diff --git a/spec/ruby/core/string/tr_spec.rb b/spec/ruby/core/string/tr_spec.rb
index efd5a7f638..8a33dd24f5 100644
--- a/spec/ruby/core/string/tr_spec.rb
+++ b/spec/ruby/core/string/tr_spec.rb
@@ -72,32 +72,30 @@ describe "String#tr" do
end
end
- with_feature :encoding do
- # http://redmine.ruby-lang.org/issues/show/1839
- it "can replace a 7-bit ASCII character with a multibyte one" do
- a = "uber"
- a.encoding.should == Encoding::UTF_8
- b = a.tr("u","ü")
- b.should == "über"
- b.encoding.should == Encoding::UTF_8
- end
-
- it "can replace a multibyte character with a single byte one" do
- a = "über"
- a.encoding.should == Encoding::UTF_8
- b = a.tr("ü","u")
- b.should == "uber"
- b.encoding.should == Encoding::UTF_8
- end
+ # http://redmine.ruby-lang.org/issues/show/1839
+ it "can replace a 7-bit ASCII character with a multibyte one" do
+ a = "uber"
+ a.encoding.should == Encoding::UTF_8
+ b = a.tr("u","ü")
+ b.should == "über"
+ b.encoding.should == Encoding::UTF_8
+ end
- it "does not replace a multibyte character where part of the bytes match the tr string" do
- str = "椎名深夏"
- a = "\u0080\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008E\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009E\u009F"
- b = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ"
- str.tr(a, b).should == "椎名深夏"
- end
+ it "can replace a multibyte character with a single byte one" do
+ a = "über"
+ a.encoding.should == Encoding::UTF_8
+ b = a.tr("ü","u")
+ b.should == "uber"
+ b.encoding.should == Encoding::UTF_8
+ end
+ it "does not replace a multibyte character where part of the bytes match the tr string" do
+ str = "椎名深夏"
+ a = "\u0080\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008E\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009E\u009F"
+ b = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ"
+ str.tr(a, b).should == "椎名深夏"
end
+
end
describe "String#tr!" do