more block tests

instance and arg access
This commit is contained in:
Torsten Ruger 2018-07-31 19:44:40 +03:00
parent 04bcfea8ce
commit 81cc109d1e
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,28 @@
require_relative "../helper"
module Risc
class BlockAssignArg < MiniTest::Test
include Ticker
def setup
@string_input = block_main("yielder {arg = 10 ; return 15} ; return arg")
super
end
def test_chain
run_all
assert_equal 10 , get_return
end
end
class BlockAssignInst < MiniTest::Test
include Ticker
def setup
@string_input = block_main("yielder {@nil_object = 1 ; return 15} ; return @nil_object")
super
end
def test_chain
run_all
assert_equal 1 , get_return
end
end
end

View File

@ -0,0 +1,15 @@
require_relative "../helper"
module Risc
class BlockCallSimple < MiniTest::Test
include Ticker
def setup
@string_input = block_main("a = yielder {return 16.div4} ; return a")
super
end
def test_chain
run_all
assert_equal 4 , get_return
end
end
end