fix while.to_vool
sanitize normalizer on the way - return ruby, let caller to_vool - return single statement, not single? statements
This commit is contained in:
@ -19,7 +19,6 @@ module Ruby
|
||||
lst = compile( basic_while )
|
||||
assert_equal TrueConstant , lst.body.class
|
||||
end
|
||||
|
||||
def reverse_while
|
||||
"true while(false)"
|
||||
end
|
||||
|
41
test/ruby/test_while_statement1.rb
Normal file
41
test/ruby/test_while_statement1.rb
Normal file
@ -0,0 +1,41 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Ruby
|
||||
class TestWhileStatementVool < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "while(@arg) ; @arg = 1 ; end" ).to_vool
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::WhileStatement , @lst.class
|
||||
end
|
||||
def test_body_class
|
||||
assert_equal Vool::IvarAssignment , @lst.body.class
|
||||
end
|
||||
def test_condition_class
|
||||
assert_equal Vool::InstanceVariable , @lst.condition.class
|
||||
end
|
||||
def test_no_hoist
|
||||
assert_nil @lst.hoisted
|
||||
end
|
||||
end
|
||||
class TestWhileStatementHoist < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "while(arg > 1) ; arg = 1 ; end" ).to_vool
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::WhileStatement , @lst.class
|
||||
assert_equal Vool::LocalAssignment , @lst.body.class
|
||||
end
|
||||
def test_condition_class
|
||||
assert_equal Vool::LocalVariable , @lst.condition.class
|
||||
end
|
||||
def test_hoist
|
||||
assert_equal Vool::LocalAssignment , @lst.hoisted.class
|
||||
end
|
||||
def test_hoist_is_cond
|
||||
assert_equal @lst.hoisted.name , @lst.condition.name
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user