require_relative "../parser_helper" class TestExpressions < MiniTest::Test # include the magic (setup and parse -> test method translation), see there include ParserHelper def test_expression_else @input = <[{:name=>"dud"}, {:call_site=>{:name=>"fuu"}, :argument_list=>[{:argument=>{:integer=>"3"}}]}], :else=>"else"} @output ={:expressions=>[Ast::NameExpression.new("dud"), Ast::CallSiteExpression.new("fuu", [Ast::IntegerExpression.new(3)] )], :else=>"else"} @root = :expressions_else end def test_expression_end @input = <[{:name=>"name"}, {:call_site=>{:name=>"call"}, :argument_list=>[{:argument=>{:integer=>"4"}}, {:argument=>{:integer=>"6"}}]}], :end=>"end"} @output = {:expressions=>[Ast::NameExpression.new("name"), Ast::CallSiteExpression.new("call", [Ast::IntegerExpression.new(4),Ast::IntegerExpression.new(6)] )], :end=>"end"} @root = :expressions_end end end