From a1d6532ef658af477fc91fa27565983466500e1c Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 9 Jun 2012 14:36:56 +0000 Subject: iseq.c: rb_id2str * iseq.c (iseq_load, insn_operand_intern, rb_iseq_disasm) (rb_iseq_parameters): use rb_id2str() instead of rb_id2name() to keep encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_iseq.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 2fa8f2399a..c30a0f9f20 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -15,4 +15,12 @@ class TestISeq < Test::Unit::TestCase e = assert_raise(TypeError) {RubyVM::InstructionSequence.load(ary)} assert_match(/:foobar/, e.message) end if defined?(RubyVM::InstructionSequence.load) + + def test_disasm_encoding + src = "\u{3042} = 1" + enc = Encoding.default_internal || Encoding.default_external + assert_equal(enc, RubyVM::InstructionSequence.compile(src.encode(enc)).disasm.encoding) + enc = enc == Encoding::UTF_8 ? Encoding::Shift_JIS : Encoding::UTF_8 + assert_equal(true, RubyVM::InstructionSequence.compile(src.encode(enc)).disasm.ascii_only?) + end end -- cgit v1.2.3