From a8cb9b02a0ad6c9bb656ce5154c5483de36f5b12 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 26 Feb 2014 05:10:46 +0000 Subject: eval.c: preserve encoding * eval.c (setup_exception): preserve exception class name encoding in debug mode messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/ruby/test_exception.rb') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index ffcee80ca3..aabe1464b1 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -100,6 +100,23 @@ class TestException < Test::Unit::TestCase assert_include(err, bug9568.to_s) end + def test_errinfo_encoding_in_debug + exc = Module.new {break class_eval("class C\u{30a8 30e9 30fc} < RuntimeError; self; end".encode(Encoding::EUC_JP))} + exc.inspect + + err = EnvUtil.verbose_warning do + assert_raise(exc) do + $DEBUG, debug = true, $DEBUG + begin + raise exc + ensure + $DEBUG = debug + end + end + end + assert_include(err, exc.to_s) + end + def test_break_ensure bad = true while true -- cgit v1.2.3