summaryrefslogtreecommitdiff
path: root/spec/ruby/language/string_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2019-04-28 23:20:11 +0200
committerBenoit Daloze <[email protected]>2019-04-28 23:20:11 +0200
commit79671ec57e59091260a0bc3d40a31d31d9c72a94 ()
tree2f59a8727b8f63f9e79d50352fa4f78a7cc00234 /spec/ruby/language/string_spec.rb
parent994833085ae06afbe94d30ab183d80e0234fbe14 (diff)
Update to ruby/spec@7de852d
-rw-r--r--spec/ruby/language/string_spec.rb42
1 files changed, 20 insertions, 22 deletions
@@ -257,33 +257,31 @@ describe "Ruby String literals" do
end
-with_feature :encoding do
- describe "Ruby String interpolation" do
- it "creates a String having an Encoding compatible with all components" do
- a = "\u3042"
- b = "abc".encode("ascii-8bit")
- str = "#{a} x #{b}"
- str.should == "\xe3\x81\x82\x20\x78\x20\x61\x62\x63".force_encoding("utf-8")
- str.encoding.should == Encoding::UTF_8
- end
- it "creates a String having the Encoding of the components when all are the same Encoding" do
- a = "abc".force_encoding("euc-jp")
- b = "def".force_encoding("euc-jp")
- str = '"#{a} x #{b}"'.force_encoding("euc-jp")
- result = eval(str)
- result.should == "\x61\x62\x63\x20\x78\x20\x64\x65\x66".force_encoding("euc-jp")
- result.encoding.should == Encoding::EUC_JP
- end
- it "raises an Encoding::CompatibilityError if the Encodings are not compatible" do
- a = "\u3042"
- b = "\xff".force_encoding "ascii-8bit"
- lambda { "#{a} #{b}" }.should raise_error(Encoding::CompatibilityError)
- end
end
end