fix and test function transform without braces

This commit is contained in:
Torsten Ruger
2014-06-26 12:46:34 +03:00
parent 9a1dd3ba1d
commit edd77bc218
2 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,17 @@ HERE
@parser = @parser
end
def test_function_no_braces
@string_input = <<HERE
def foo
5
end
HERE
@parse_output = {:expression_list=>[{:function_name=>{:name=>"foo"}, :expressions=>[{:integer=>"5"}], :end=>"end"}]}
@transform_output = Ast::ExpressionList.new( [Ast::FunctionExpression.new(:foo, [] , [Ast::IntegerExpression.new(5)] ,nil )])
@parser = @parser
end
def test_class_function
@string_input = <<HERE
def String.length(x)