From e68cf6f561560b624ea7a74eda0bd9d58f7020b1 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 15 Feb 2014 16:29:10 +0000 Subject: merge revision(s) r44758,r44759,r44760: [Backport #9466] object.c: error message encoding * object.c (convert_type, rb_convert_type, rb_check_convert_type), (rb_to_integer): preserve class name encoding error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 18b0d6f725..107d80b1a4 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -224,6 +224,25 @@ class TestException < Test::Unit::TestCase assert_raise(ArgumentError) { raise 1, 1, 1, 1 } end + def test_type_error_message_encoding + c = eval("Module.new do break class C\u{4032}; self; end; end") + o = c.new + e = assert_raise(TypeError) do + ""[o] + end + assert_match(/C\u{4032}/, e.message) + c.class_eval {def to_int; self; end} + e = assert_raise(TypeError) do + ""[o] + end + assert_match(/C\u{4032}/, e.message) + c.class_eval {def to_a; self; end} + assert_raise(TypeError) do + [*o] + end + assert_match(/C\u{4032}/, e.message) + end + def test_errat assert_in_out_err([], "p $@", %w(nil), []) -- cgit v1.2.3