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