mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
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/trunk@44758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f1e4777d45
commit
be604acda7
2 changed files with 39 additions and 16 deletions
|
@ -221,6 +221,22 @@ 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
|
||||
assert_raise_with_message(TypeError, /C\u{4032}/) do
|
||||
""[o]
|
||||
end
|
||||
c.class_eval {def to_int; self; end}
|
||||
assert_raise_with_message(TypeError, /C\u{4032}/) do
|
||||
""[o]
|
||||
end
|
||||
c.class_eval {def to_a; self; end}
|
||||
assert_raise_with_message(TypeError, /C\u{4032}/) do
|
||||
[*o]
|
||||
end
|
||||
end
|
||||
|
||||
def test_errat
|
||||
assert_in_out_err([], "p $@", %w(nil), [])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue