using hash_key and value rules
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
|
||||
require_relative "test_basic"
|
||||
require_relative "test_compund"
|
||||
require_relative "test_compound"
|
||||
require_relative "test_arguments"
|
||||
require_relative "test_expressions"
|
||||
require_relative "test_function_call"
|
||||
|
@ -29,14 +29,14 @@ class TestCompound < MiniTest::Test
|
||||
|
||||
def test_hash
|
||||
@string_input = '{ foo => 33 }'
|
||||
@parse_output = {:hash=>[{:hash_pair=>{:argument=>{:name=>"foo"}, :element=>{:integer=>"33"}}}]}
|
||||
@parse_output = {:hash=>[{:hash_pair=>{:hash_key=>{:name=>"foo"}, :hash_value=>{:integer=>"33"}}}]}
|
||||
@transform_output = Ast::HashExpression.new([Ast::AssociationExpression.new(Ast::NameExpression.new("foo") , Ast::IntegerExpression.new(33))])
|
||||
@parser = @parser.hash
|
||||
end
|
||||
|
||||
def test_hash_list
|
||||
@string_input = "{foo => 33 , bar => 42}"
|
||||
@parse_output = {:hash=>[{:hash_pair=>{:argument=>{:name=>"foo"}, :element=>{:integer=>"33"}}}, {:hash_pair=>{:argument=>{:name=>"bar"}, :element=>{:integer=>"42"}}}]}
|
||||
@parse_output = {:hash=>[{:hash_pair=>{:hash_key=>{:name=>"foo"}, :hash_value=>{:integer=>"33"}}}, {:hash_pair=>{:hash_key=>{:name=>"bar"}, :hash_value=>{:integer=>"42"}}}]}
|
||||
@transform_output = Ast::HashExpression.new([Ast::AssociationExpression.new(Ast::NameExpression.new("foo") , Ast::IntegerExpression.new(33)),Ast::AssociationExpression.new(Ast::NameExpression.new("bar") , Ast::IntegerExpression.new(42))])
|
||||
@parser = @parser.hash
|
||||
end
|
||||
|
Reference in New Issue
Block a user