spec/formula_peg_spec.rb in rubyfromexcel-0.0.9 vs spec/formula_peg_spec.rb in rubyfromexcel-0.0.10
- old
+ new
@@ -142,9 +142,11 @@
Formula.parse('[Sale Amount]').to_ast.should == [:formula,[:local_table_reference,'Sale Amount']]
end
it "returns named references" do
Formula.parse('EF.NaturalGas.N2O').to_ast.should == [:formula,[:named_reference,'EF.NaturalGas.N2O']]
+ Formula.parse('USD2009_').to_ast.should == [:formula,[:named_reference,'USD2009_']]
+ Formula.parse('(F47*(USD2009_/Unit.boe))*(Price2009)').to_ast.should == [:formula, [:arithmetic, [:brackets, [:arithmetic, [:cell, "F47"], [:operator, "*"], [:brackets, [:arithmetic, [:named_reference, "USD2009_"], [:operator, "/"], [:named_reference, "Unit.boe"]]]]], [:operator, "*"], [:brackets, [:named_reference, "Price2009"]]]]
end
it "returns infix modifiers in edge cases" do
complex = "(-'DUKES 09 (2.5)'!$B$25)"
Formula.parse(complex).to_ast.should == [:formula, [:brackets, [:prefix, "-", [:quoted_sheet_reference, "DUKES 09 (2.5)", [:cell, "$B$25"]]]]]
\ No newline at end of file