aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/inspect_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/inspect_spec.rb')
-rw-r--r--spec/ruby/core/string/inspect_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/string/inspect_spec.rb b/spec/ruby/core/string/inspect_spec.rb
index 2cfcfe0e76..c1674c73c8 100644
--- a/spec/ruby/core/string/inspect_spec.rb
+++ b/spec/ruby/core/string/inspect_spec.rb
@@ -489,4 +489,12 @@ describe "String#inspect" do
].should be_computed_by(:inspect)
end
end
+
+ describe "when the string's encoding is different than the result's encoding" do
+ describe "and the string's encoding is ASCII-compatible but the characters are non-ASCII" do
+ it "returns a string with the non-ASCII characters replaced by \\x notation" do
+ "\u{3042}".encode("EUC-JP").inspect.should == '"\\x{A4A2}"'
+ end
+ end
+ end
end