spec/front_end/parser_spec.rb in loxxy-0.3.01 vs spec/front_end/parser_spec.rb in loxxy-0.3.02
- old
+ new
@@ -351,12 +351,12 @@
ptree = subject.parse(input)
expr = ptree.root.subnodes[0]
expect(expr).to be_kind_of(Ast::LoxSetExpr)
expect(expr.object.name).to eq('someObject')
expect(expr.property).to eq('someProperty')
- expect(expr.subnodes[0]).to be_kind_of(Ast::LoxVariableExpr)
- expect(expr.subnodes[0].name).to eq('value')
+ expect(expr.value).to be_kind_of(Ast::LoxVariableExpr)
+ expect(expr.value.name).to eq('value')
end
it 'should parse complex set access' do
input = 'breakfast.omelette.filling.meat = ham;'
# From section 12.3.2, one expects something like:
@@ -370,11 +370,11 @@
# +- object = LoxVariableExpr 'breakfast'
ptree = subject.parse(input)
expr = ptree.root.subnodes[0]
expect(expr).to be_kind_of(Ast::LoxSetExpr)
expect(expr.property).to eq('meat')
- expect(expr.subnodes[0]).to be_kind_of(Ast::LoxVariableExpr)
- expect(expr.subnodes[0].name).to eq('ham')
+ expect(expr.value).to be_kind_of(Ast::LoxVariableExpr)
+ expect(expr.value.name).to eq('ham')
expect(expr.object).to be_kind_of(Ast::LoxGetExpr)
expect(expr.object.property).to eq('filling')
expect(expr.object.object).to be_kind_of(Ast::LoxGetExpr)
expect(expr.object.object.property).to eq('omelette')
expect(expr.object.object.object).to be_kind_of(Ast::LoxVariableExpr)