From 8c321128d91fadb45c12bbbbd9637bf81f76be2a Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 3 Sep 2008 18:22:21 +0000 Subject: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby/test_io_m17n.rb') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index b8b532e94c..67f48527b5 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -791,6 +791,21 @@ EOT } end + def test_set_encoding_undef_replace + with_pipe {|r, w| + w << "\ufffd" + w.close + r.set_encoding("utf-8", "euc-jp", :undef=>:replace, :replace=>"ZZZ") + assert_equal("ZZZ", r.read) + } + with_pipe {|r, w| + w << "\ufffd" + w.close + r.set_encoding("utf-8:euc-jp", :undef=>:replace, :replace=>"ZZZ") + assert_equal("ZZZ", r.read) + } + end + def test_write_conversion_fixenc with_pipe {|r, w| w.set_encoding("iso-2022-jp:utf-8") -- cgit v1.2.3