Skip to content

Commit f2c8cc7

Browse files
committed
Add a String#inspect spec for MBC strings in an ASCII-compatible encoding that's different from the default internal & external encodings.
1 parent d2b8304 commit f2c8cc7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/ruby/core/string/inspect_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,4 +489,12 @@
489489
].should be_computed_by(:inspect)
490490
end
491491
end
492+
493+
describe "when the string's encoding is different than the result's encoding" do
494+
describe "and the string's encoding is ASCII-compatible but the characters are non-ASCII" do
495+
it "returns a string with the non-ASCII characters replaced by \\x notation" do
496+
"\u{3042}".encode("EUC-JP").inspect.should == '"\\x{A4A2}"'
497+
end
498+
end
499+
end
492500
end

0 commit comments

Comments
 (0)