summaryrefslogtreecommitdiff
path: root/test/ruby/test_exception.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-28 22:32:36 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-28 22:32:36 +0000
commit398739218754cfd68dca86443b1301ed1ffed359 (patch)
tree3e76cc7dea09b7a482489fb81f112bc176ddc8aa /test/ruby/test_exception.rb
parent0e579dd62000632117e35030ccb9e698af7771f0 (diff)
* test/ruby/test_exception.rb (TestException#test_output_string_encoding): test
for r48637. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r--test/ruby/test_exception.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 7ce57cce8d..f5e1179af7 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -673,4 +673,16 @@ end.join
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