From 7084c015bf09fbe1687f51953fce0f96fc48dab9 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 5 Apr 2018 13:13:00 +0000 Subject: compile.c: fix positions encode * compile.c (ibf_load_iseq_each): iseq_size necessary to encode positions is set in ibf_load_code(). [Bug #14660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_iseq.rb | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 315771db3d..2c8acb6421 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -396,18 +396,37 @@ class TestISeq < Test::Unit::TestCase } end - def test_to_binary_with_objects + def assert_iseq_to_binary(code, mesg = nil) skip "does not work on other than x86" unless /x(?:86|64)|i\d86/ =~ RUBY_PLATFORM - code = "[]"+100.times.map{|i|"< e skip e.message if /compile with coverage/ =~ e.message raise end - skip "trace events does not load correctly since r62851" + 10.times do + assert_equal(bin, iseq.to_binary, mesg) + end iseq2 = RubyVM::InstructionSequence.load_from_binary(bin) - assert_equal(iseq.to_a, iseq2.to_a) + assert_equal(iseq.to_a, iseq2.to_a, mesg) + iseq2 + end + + def test_to_binary_with_objects + assert_iseq_to_binary("[]"+100.times.map{|i|"<