spec/spec_helper.rb in dentaku-2.0.11 vs spec/spec_helper.rb in dentaku-3.0.0

- old
+ new

@@ -1,7 +1,11 @@ require 'pry' +require 'coveralls' +# Check the amount of testcoverage +Coveralls.wear! + # automatically create a token stream from bare values def token_stream(*args) args.map do |value| type = type_for(value) Dentaku::Token.new(type, value) @@ -19,10 +23,12 @@ :logical when :add, :subtract, :multiply, :divide, :mod, :pow :operator when :open, :close, :comma :grouping + when :lbracket, :rbracket + :access when :le, :ge, :ne, :ne, :lt, :gt, :eq :comparator when :and, :or :combinator when :if, :round, :roundup, :rounddown, :not @@ -31,11 +37,15 @@ :identifier end end def identifier(name) - Dentaku::AST::Identifier.new(Dentaku::Token.new(:identifier, name)) + Dentaku::AST::Identifier.new(token(name)) end def literal(value) - Dentaku::AST::Literal.new(Dentaku::Token.new(type_for(value), value)) + Dentaku::AST::Literal.new(token(value)) +end + +def token(value) + Dentaku::Token.new(type_for(value), value) end