ruby-changes:36558
From: usa <ko1@a...>
Date: Sat, 29 Nov 2014 07:32:50 +0900 (JST)
Subject: [ruby-changes:36558] usa:r48639 (trunk): * test/ruby/test_exception.rb (TestException#test_output_string_encoding): test
usa 2014-11-29 07:32:36 +0900 (Sat, 29 Nov 2014) New Revision: 48639 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48639 Log: * test/ruby/test_exception.rb (TestException#test_output_string_encoding): test for r48637. Modified files: trunk/test/ruby/test_exception.rb Index: test/ruby/test_exception.rb =================================================================== --- test/ruby/test_exception.rb (revision 48638) +++ test/ruby/test_exception.rb (revision 48639) @@ -673,4 +673,16 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L673 assert_equal(:foo, e.name) assert_equal([1, 2], e.args) end + + def test_output_string_encoding + # "\x82\xa0" in cp932 is "\u3042" (Japanese hiragana 'a') + # change $stderr to force calling rb_io_write() instead of fwrite() + assert_in_out_err(["-Eutf-8:cp932"], '$stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| + assert_equal 1, outs.size + assert_equal 0, errs.size + err = outs.first.force_encoding('utf-8') + assert err.valid_encoding?, 'must be valid encoding' + assert_match /\u3042/, err + end + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/