rubyx/test/vool/test_if_statement.rb

30 lines
704 B
Ruby
Raw Normal View History

2017-04-02 18:12:42 +02:00
require_relative 'helper'
module Vool
class TestIfStatement < MiniTest::Test
def basic_if
"if(10 < 12) ; true ; end"
end
def test_if_basic
lst = Compiler.compile( basic_if )
assert_equal IfStatement , lst.class
end
def test_if_basic_cond
lst = Compiler.compile( basic_if )
assert_equal SendStatement , lst.condition.class
end
def test_if_basic_branches
lst = Compiler.compile( basic_if )
assert_equal TrueStatement , lst.if_true.class
assert_nil lst.if_false
end
def test_if_double
lst = Compiler.compile( "if(false) ; true ; else ; false; end" )
assert_equal IfStatement , lst.class
2017-04-02 18:12:42 +02:00
end
end
end