spec/evaluator_spec.rb in dentaku-1.2.4 vs spec/evaluator_spec.rb in dentaku-1.2.5

- old
+ new

@@ -1,10 +1,11 @@ require 'spec_helper' require 'dentaku/evaluator' describe Dentaku::Evaluator do - let(:evaluator) { Dentaku::Evaluator.new } + let(:rule_set) { Dentaku::RuleSet.new } + let(:evaluator) { Dentaku::Evaluator.new(rule_set) } describe 'rule scanning' do it 'finds a matching rule' do rule = [Dentaku::TokenMatcher.new(:numeric, nil)] stream = [Dentaku::Token.new(:numeric, 1), Dentaku::Token.new(:operator, :add), Dentaku::Token.new(:numeric, 1)] @@ -79,10 +80,10 @@ end end describe 'find_rule_match' do it 'matches a function call' do - if_pattern, _ = *Dentaku::Rules.core_rules.first + if_pattern, _ = *rule_set.rules.first position, tokens = evaluator.find_rule_match(if_pattern, token_stream(:if, :fopen, true, :comma, 1, :comma, 2, :close)) expect(position).to eq 0 expect(tokens.length).to eq 8 end