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
This commit is contained in:
nobu 2012-06-09 14:36:56 +00:00
parent f64e7c834f
commit a1d6532ef6
3 changed files with 47 additions and 29 deletions

View file

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