Browse files

Failing test for encoding a string where target == source encoding

  • Loading branch information...
1 parent 2242f14 commit d53aceec3e22d8d0f01e3eb23ab47960ef2b5d81 @benlangfeld committed Nov 13, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 spec/ruby/core/string/encode_spec.rb
View
6 spec/ruby/core/string/encode_spec.rb
@@ -58,6 +58,12 @@
str.encoding.should == Encoding::UTF_8
end
+ it "returns self when called when target encoding equals source encoding" do
+ str = "caf\xe9".force_encoding("iso-8859-1")
+ copy = str.encode "iso-8859-1", "iso-8859-1"
+ copy.encoding.should == Encoding::ISO_8859_1
+ end
+
it "returns a copy of self even when no changes are made" do
str = "strung".force_encoding('ASCII')
str.encode(Encoding::UTF_8).object_id.should_not == str.object_id

0 comments on commit d53acee

Please sign in to comment.