Sha256: 633a12e09921f6cec612c865bda72af99b99a18c6cd6c68a08b746319b97d20f
Contents?: true
Size: 476 Bytes
Versions: 1
Compression:
Stored size: 476 Bytes
Contents
require 'spec_helper' module Sexpr describe Sequence, "eat" do let(:alt1){ Terminal.new(nil) } let(:alt2){ Terminal.new(/^[a-z]+$/) } let(:rule){ Sequence.new [alt1, alt2] } it 'returns the subarray when match' do rule.eat([nil, "world", "then"]).should eq(["then"]) end it 'returns nil when no match' do rule.eat([]).should be_nil rule.eat(["12"]).should be_nil rule.eat([nil]).should be_nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sexpr-0.2.0 | spec/sequence/test_eat.rb |