2018-08-01 15:31:16 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Risc
|
2019-09-13 13:07:12 +02:00
|
|
|
class BlockCallSimpleWithArg < MiniTest::Test
|
2018-08-01 15:31:16 +02:00
|
|
|
include Ticker
|
|
|
|
def setup
|
|
|
|
@string_input = block_main("a = tenner {|b| return b} ; return a" , tenner)
|
|
|
|
super
|
|
|
|
end
|
|
|
|
def test_chain
|
|
|
|
run_all
|
|
|
|
assert_equal 10 , get_return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class BlockCallArgOp < MiniTest::Test
|
|
|
|
include Ticker
|
|
|
|
def setup
|
2019-09-13 13:07:12 +02:00
|
|
|
@preload = "Integer.mul"
|
2018-08-01 15:31:16 +02:00
|
|
|
@string_input = block_main("a = tenner {|b| return 2 * b} ; return a" , tenner)
|
|
|
|
super
|
|
|
|
end
|
|
|
|
def test_chain
|
|
|
|
run_all
|
|
|
|
assert_equal 20 , get_return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|