Sha256: 51b3c16862897103110a8ab2b9bc8945f9bfa4dc9b43c5eca79a8d3b734efdec
Contents?: true
Size: 535 Bytes
Versions: 4
Compression:
Stored size: 535 Bytes
Contents
require 'spec_helper' module Sexpr::Matcher describe Rule, "eat" do let(:defn){ Sequence.new [Terminal.new(/^[a-z]+$/)] } let(:rule){ Rule.new :hello, defn } it 'returns the trailing array when match' do rule.eat([[:hello, "world"], "!"]).should eq(["!"]) end it 'returns nil when not match' do rule.eat([:hello, "world"]).should be_nil rule.eat([:hello]).should be_nil rule.eat([]).should be_nil rule.eat([[]]).should be_nil rule.eat([nil]).should be_nil end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sexpr-0.5.1 | spec/matcher/rule/test_eat.rb |
sexpr-0.5.0 | spec/matcher/rule/test_eat.rb |
sexpr-0.4.0 | spec/matcher/rule/test_eat.rb |
sexpr-0.3.0 | spec/matcher/rule/test_eat.rb |