fix call expression tests

This commit is contained in:
Torsten Ruger 2016-12-10 15:26:25 +02:00
parent 4054b61752
commit 4f7110ef04
2 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
require_relative "test_basic" require_relative "test_basic"
require_relative "test_field_access" require_relative "test_field_access"
require_relative "test_ops" require_relative "test_ops"
#require_relative "test_call" require_relative "test_call"

View File

@ -3,6 +3,7 @@ require_relative "helper"
module Register module Register
class TestCall < MiniTest::Test class TestCall < MiniTest::Test
include ExpressionHelper include ExpressionHelper
include AST::Sexp
def setup def setup
Register.machine.boot Register.machine.boot
@ -10,28 +11,28 @@ module Register
end end
def test_call_main_plain def test_call_main_plain
@input = 'main()' @input = s(:call, s(:name, :main), s(:arguments))
check check
end end
def test_call_main_int def test_call_main_int
@input = 'main(1)' @input = s(:call, s(:name, :main), s(:arguments , s(:int, 1)))
check check
end end
def test_call_main_string def test_call_main_string
@input = 'main("1")' @input = s(:call, s(:name, :main), s(:arguments , s(:string, "1") ))
check check
end end
def test_call_main_op def test_call_main_op
Register.machine.space.get_main.ensure_local(:bar , :Integer) Register.machine.space.get_main.ensure_local(:bar , :Integer)
@input = 'main( bar )' @input = s(:call, s(:name, :main), s(:arguments , s(:name, :bar) ))
check check
end end
def test_call_string_put def test_call_string_put
@input = '"Hello Raisa, I am salama".putstring()' @input = s(:call, s(:name, :putstring), s(:arguments), s(:receiver, s(:string, "Hello Raisa, I am salama")))
check check
end end