2014-04-29 15:22:39 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
class TestArguments < MiniTest::Test
|
|
|
|
# include the magic (setup and parse -> test method translation), see there
|
|
|
|
include ParserHelper
|
|
|
|
|
|
|
|
def test_one_argument
|
|
|
|
@string_input = '(42)'
|
|
|
|
@parse_output = {:argument_list => [{:argument => {:integer => '42'}}] }
|
2014-05-05 08:51:16 +02:00
|
|
|
@transform_output = [Ast::IntegerExpression.new(42) ]
|
2014-04-29 15:22:39 +02:00
|
|
|
@parser = @parser.argument_list
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_argument_list
|
|
|
|
@string_input = '(42, foo)'
|
|
|
|
@parse_output = {:argument_list => [{:argument => {:integer => '42'}},
|
|
|
|
{:argument => {:name => 'foo'}}]}
|
2014-05-05 08:51:16 +02:00
|
|
|
@transform_output = [Ast::IntegerExpression.new(42), Ast::NameExpression.new('foo')]
|
2014-04-29 15:22:39 +02:00
|
|
|
@parser = @parser.argument_list
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_parmeter
|
|
|
|
@string_input = "(foo)"
|
|
|
|
@parse_output = {:parmeter_list => [{:parmeter => { :name => "foo"}} ]}
|
2014-05-05 08:51:16 +02:00
|
|
|
@transform_output = [Ast::NameExpression.new('foo')]
|
2014-04-29 15:22:39 +02:00
|
|
|
@parser = @parser.parmeter_list
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_parmeter_list
|
|
|
|
@string_input = "( foo , bar)"
|
|
|
|
@parse_output = {:parmeter_list => [{:parmeter => { :name => "foo"}},
|
|
|
|
{:parmeter => { :name => "bar"}} ]}
|
2014-05-05 08:51:16 +02:00
|
|
|
@transform_output = [Ast::NameExpression.new('foo') , Ast::NameExpression.new('bar')]
|
2014-04-29 15:22:39 +02:00
|
|
|
@parser = @parser.parmeter_list
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|