summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-15 16:29:10 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-15 16:29:10 +0000
commite68cf6f561560b624ea7a74eda0bd9d58f7020b1 (patch)
treeb180422d43c56733bf0f2c35c677864577f52753 /test
parent257ec8c9afd3cfc6e191a582d42390ce83f53c1e (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_exception.rb19
1 files changed, 19 insertions, 0 deletions
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), [])