1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-11-23 17:03:08 +00:00
parent be5bbaf5dc
commit 9519f6193a
3 changed files with 16 additions and 3 deletions

View file

@ -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

6
io.c
View file

@ -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));
}
}

View file

@ -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