aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_iseq.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_iseq.rb')
-rw-r--r--test/ruby/test_iseq.rb8
1 files changed, 8 insertions, 0 deletions
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