diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-20 05:20:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-20 05:20:39 +0000 |
commit | bd2d094aab4c672d5fef4a126087e0cded864c6c (patch) | |
tree | ac982f78cd6f3a12b88d2eef4667d3b597d37859 | |
parent | 6948188f3804e612de498dac654c278a342d49bf (diff) | |
download | ruby-bd2d094aab4c672d5fef4a126087e0cded864c6c.tar.gz |
vm_insnhelper.c: preserve encoding
* vm_insnhelper.c (vm_getivar): preserve variable name encoding in
warning message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_module.rb | 5 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index f025c1948e..5a0d819fb7 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1826,6 +1826,11 @@ class TestModule < Test::Unit::TestCase assert_warning '' do assert_equal(42, a.ivar) end + + name = "@\u{5909 6570}" + assert_warning(/instance variable #{name} not initialized/) do + assert_nil(a.instance_eval(name)) + end end def test_uninitialized_attr diff --git a/vm_insnhelper.c b/vm_insnhelper.c index b81001b0ef..495b7224fd 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -527,7 +527,7 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_call_info_t *ci, int is_attr) if (UNLIKELY(val == Qundef)) { if (!is_attr && RTEST(ruby_verbose)) - rb_warning("instance variable %s not initialized", rb_id2name(id)); + rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id)); val = Qnil; } return val; |