2018-06-28 20:15:24 +03:00
|
|
|
require_relative "helper"
|
|
|
|
|
2018-07-19 14:46:51 +03:00
|
|
|
module Ruby
|
2019-08-16 21:43:54 +03:00
|
|
|
class TestYieldStatement < MiniTest::Test
|
2018-07-21 14:34:39 +03:00
|
|
|
include RubyTests
|
|
|
|
|
|
|
|
def setup()
|
|
|
|
input = "yield(0)"
|
2019-08-16 21:43:54 +03:00
|
|
|
@lst = compile( input )
|
2018-07-21 14:34:39 +03:00
|
|
|
end
|
|
|
|
def test_block
|
2019-08-16 21:43:54 +03:00
|
|
|
assert_equal YieldStatement , @lst.class
|
2018-07-21 14:34:39 +03:00
|
|
|
end
|
|
|
|
def test_block_args
|
2019-08-16 21:43:54 +03:00
|
|
|
assert_equal IntegerConstant , @lst.arguments.first.class
|
|
|
|
end
|
|
|
|
def test_tos
|
|
|
|
assert_equal "yield(0)" , @lst.to_s
|
2018-07-21 14:34:39 +03:00
|
|
|
end
|
|
|
|
end
|
2019-10-04 00:36:49 +03:00
|
|
|
class TestYieldStatementSol < MiniTest::Test
|
2018-06-29 22:46:39 +03:00
|
|
|
include RubyTests
|
2018-06-28 20:15:24 +03:00
|
|
|
|
|
|
|
def setup()
|
2018-07-21 14:34:39 +03:00
|
|
|
input = "yield(0)"
|
2019-10-04 00:36:49 +03:00
|
|
|
@lst = compile( input ).to_sol
|
2018-06-28 20:15:24 +03:00
|
|
|
end
|
|
|
|
def test_block
|
2019-10-04 00:36:49 +03:00
|
|
|
assert_equal Sol::YieldStatement , @lst.class
|
2018-06-28 20:15:24 +03:00
|
|
|
end
|
|
|
|
def test_block_args
|
2019-10-04 00:36:49 +03:00
|
|
|
assert_equal Sol::IntegerConstant , @lst.arguments.first.class
|
2018-09-01 15:54:25 +03:00
|
|
|
end
|
2018-06-28 20:15:24 +03:00
|
|
|
end
|
|
|
|
end
|