summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-14 07:42:08 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-14 07:42:08 +0000
commit62550b1d0f07389e2806540047b8ea409ec2d707 (patch)
treec92bb297985f052911a751f93652395f678eee44 /test
parent640c135cbe3a0147cca1e9bf767d8cc5ae72b2bd (diff)
merge revision(s) 51116: [Backport #11324]
* transcode.c (rb_econv_set_replacement): target encoding name can be empty now. [ruby-core:69841] [Bug #11324] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_transcode.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb
index 8ace00c172..4bade11a51 100644
--- a/test/ruby/test_transcode.rb
+++ b/test/ruby/test_transcode.rb
@@ -2109,4 +2109,13 @@ class TestTranscode < Test::Unit::TestCase
assert_equal([expected]*num, result, bug11277)
end;
end
+
+ def test_universal_newline
+ bug11324 = '[ruby-core:69841] [Bug #11324]'
+ usascii = Encoding::US_ASCII
+ s = "A\nB\r\nC".force_encoding(usascii)
+ assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true), bug11324)
+ assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true, undef: :replace), bug11324)
+ assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true, undef: :replace, replace: ''), bug11324)
+ end
end