From 64241b0921e2ae24dd69d225e5d59de5dde77ac5 Mon Sep 17 00:00:00 2001 From: normal Date: Sun, 28 Dec 2014 09:20:21 +0000 Subject: test_iseq_load: expand tests with stack mismatches We can ensure the loader works for these cases even if the reoptimized bytecode is not a match for the original. * test/-ext-/iseq_load/test_iseq_load.rb (test_next_in_block_in_block): test using ISeq#eval (test_break_ensure): ditto [ruby-core:66988] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/-ext-/iseq_load/test_iseq_load.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'test/-ext-/iseq_load') diff --git a/test/-ext-/iseq_load/test_iseq_load.rb b/test/-ext-/iseq_load/test_iseq_load.rb index 5bbd49efba..7251603b0a 100644 --- a/test/-ext-/iseq_load/test_iseq_load.rb +++ b/test/-ext-/iseq_load/test_iseq_load.rb @@ -52,16 +52,21 @@ class TestIseqLoad < Test::Unit::TestCase end def test_next_in_block_in_block - skip "failing due to stack_max mismatch" - assert_iseq_roundtrip <<-'end;' - 3.times { 3.times { next } } + @next_broke = false + src = <<-'end;' + 3.times { 3.times { next; @next_broke = true } } end; + a = ISeq.compile(src).to_a + iseq = ISeq.iseq_load(a) + iseq.eval + assert_equal false, @next_broke + skip "failing due to stack_max mismatch" + assert_iseq_roundtrip(src) end def test_break_ensure - skip "failing due to exception entry sp mismatch" - assert_iseq_roundtrip <<-'end;' - def m + src = <<-'end;' + def test_break_ensure_def_method bad = true while true begin @@ -70,8 +75,15 @@ class TestIseqLoad < Test::Unit::TestCase bad = false end end + bad end end; + a = ISeq.compile(src).to_a + iseq = ISeq.iseq_load(a) + iseq.eval + assert_equal false, test_break_ensure_def_method + skip "failing due to exception entry sp mismatch" + assert_iseq_roundtrip(src) end # FIXME: still failing -- cgit v1.2.3