test_optimization.rb: disasm
* test/ruby/test_optimization.rb (disasm): dump disassembled code for investigation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
88c7ffb251
commit
263177507e
@ -30,6 +30,10 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def disasm(name)
|
||||||
|
RubyVM::InstructionSequence.of(method(name)).disasm
|
||||||
|
end
|
||||||
|
|
||||||
def test_fixnum_plus
|
def test_fixnum_plus
|
||||||
a, b = 1, 2
|
a, b = 1, 2
|
||||||
assert_equal 3, a + b
|
assert_equal 3, a + b
|
||||||
@ -262,7 +266,7 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||||||
fact_helper(n, 1)
|
fact_helper(n, 1)
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
assert_equal(9131, fact(3000).to_s.size, bug4082)
|
assert_equal(9131, fact(3000).to_s.size, message(bug4082) {disasm(:fact_helper)})
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tailcall_with_block
|
def test_tailcall_with_block
|
||||||
@ -279,7 +283,7 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
assert_equal(123, delay { 123 }.call, bug6901)
|
assert_equal(123, delay { 123 }.call, message(bug6901) {disasm(:delay)})
|
||||||
end
|
end
|
||||||
|
|
||||||
def just_yield
|
def just_yield
|
||||||
@ -292,7 +296,7 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||||||
just_yield {:ok}
|
just_yield {:ok}
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
assert_equal(:ok, yield_result)
|
assert_equal(:ok, yield_result, message {disasm(:yield_result)})
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_raise
|
def do_raise
|
||||||
@ -314,7 +318,9 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||||||
errinfo
|
errinfo
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
result = to_be_rescued
|
result = assert_nothing_raised(RuntimeError, message(bug12082) {disasm(:to_be_rescued)}) {
|
||||||
|
to_be_rescued
|
||||||
|
}
|
||||||
assert_instance_of(RuntimeError, result, bug12082)
|
assert_instance_of(RuntimeError, result, bug12082)
|
||||||
assert_equal("should be rescued", result.message, bug12082)
|
assert_equal("should be rescued", result.message, bug12082)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user