diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-23 17:03:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-23 17:03:08 +0000 |
commit | 9519f6193a940a736036ff0fe03d45b81d1dc4e8 (patch) | |
tree | 5990cbe6652a64c9fc44fa7b21cd4e7eb43237c9 | |
parent | be5bbaf5dc30933117ca671a9b5a795e3adad6cc (diff) | |
download | ruby-9519f6193a940a736036ff0fe03d45b81d1dc4e8.tar.gz |
io.c: preserve encodings
* io.c (must_respond_to): preserve encodings of variable name and
class name in warning message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | io.c | 6 | ||||
-rw-r--r-- | test/ruby/test_io.rb | 8 |
3 files changed, 16 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Mon Nov 24 02:02:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (must_respond_to): preserve encodings of variable name and + class name in warning message. + Sun Nov 23 10:46:23 2014 Eric Wong <e@80x24.org> * internal.h (struct rb_execarg): 160 => 144 bytes on x86-64 @@ -7275,9 +7275,9 @@ static void must_respond_to(ID mid, VALUE val, ID id) { if (!rb_respond_to(val, mid)) { - rb_raise(rb_eTypeError, "%s must have %s method, %s given", - rb_id2name(id), rb_id2name(mid), - rb_obj_classname(val)); + rb_raise(rb_eTypeError, "%"PRIsVALUE" must have %"PRIsVALUE" method, %"PRIsVALUE" given", + rb_id2str(id), rb_id2str(mid), + rb_obj_class(val)); } } diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 39f357a6b9..02381b132c 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2268,6 +2268,14 @@ End assert_raise(TypeError) { $> = Object.new } assert_in_out_err([], "$> = $stderr\nputs 'foo'", [], %w(foo)) + + assert_separately(%w[-Eutf-8], <<-"end;") # do + alias $\u{6a19 6e96 51fa 529b} $stdout + x = eval("class X\u{307b 3052}; self; end".encode("euc-jp")) + assert_raise_with_message(TypeError, /\\$\u{6a19 6e96 51fa 529b} must.*, X\u{307b 3052} given/) do + $\u{6a19 6e96 51fa 529b} = x.new + end + end; end def test_initialize |