rubyx/test/fragments/test_if.rb

34 lines
433 B
Ruby
Raw Normal View History

2014-05-24 10:18:54 +03:00
require_relative 'helper'
class TestIf < MiniTest::Test
include Fragments
2015-07-18 15:28:57 +03:00
def test_if_basic
@string_input = <<HERE
if( n < 12)
3
else
4
end
HERE
@expect = [Virtual::Return ]
check
end
def ttest_if_function
2014-05-24 10:18:54 +03:00
@string_input = <<HERE
def itest(n)
2014-05-24 10:18:54 +03:00
if( n < 12)
2014-06-08 00:56:40 +03:00
"then".putstring()
2014-05-24 10:18:54 +03:00
else
2014-06-08 00:56:40 +03:00
"else".putstring()
2014-05-24 10:18:54 +03:00
end
end
itest(20)
2014-05-24 10:18:54 +03:00
HERE
2015-07-18 15:28:57 +03:00
@expect = [Virtual::Return ]
check
2014-05-24 10:18:54 +03:00
end
end