fix ruby return statement

assignment and normalizer on the way
This commit is contained in:
Torsten Ruger
2018-07-20 09:07:09 +03:00
parent a5168ef818
commit 8cd9818f64
4 changed files with 30 additions and 8 deletions

View File

@ -1,6 +1,28 @@
require_relative "helper"
module Ruby
class TestReturnStatementVool < MiniTest::Test
include RubyTests
def test_return_const
lst = compile( "return 1" ).to_vool
assert_equal Vool::ReturnStatement , lst.class
end
def test_return_value
lst = compile( "return 1" ).to_vool
assert_equal 1 , lst.return_value.value
end
def test_return_send
lst = compile( "return foo" ).to_vool
assert_equal Vool::LocalAssignment , lst.first.class
end
def test_return_send
lst = compile( "return foo" ).to_vool
assert lst.last.return_value.name.to_s.start_with?("tmp_")
assert_equal 2, lst.length
end
end
class TestReturnStatement < MiniTest::Test
include RubyTests