rubyx/test/ruby/test_while_statement.rb
Torsten Ruger 6a58a71c0a fix while.to_vool
sanitize normalizer on the way
- return ruby, let caller to_vool
- return single statement, not single? statements
2018-07-20 17:51:17 +03:00

40 lines
996 B
Ruby

require_relative 'helper'
module Ruby
class TestWhileStatement < MiniTest::Test
include RubyTests
def basic_while
"while(10 < 12) ; true ; end"
end
def test_while_basic
lst = compile( basic_while )
assert_equal WhileStatement , lst.class
end
def test_while_basic_cond
lst = compile( basic_while )
assert_equal ScopeStatement , lst.condition.class
end
def test_while_basic_branches
lst = compile( basic_while )
assert_equal TrueConstant , lst.body.class
end
def reverse_while
"true while(false)"
end
def test_while_reverse_branches
lst = compile( reverse_while )
assert_equal WhileStatement , lst.class
end
def test_while_reverse_cond
lst = compile( reverse_while )
assert_equal ScopeStatement , lst.condition.class
end
def test_while_reverse_branches
lst = compile( reverse_while )
assert_equal TrueConstant , lst.body.class
end
end
end