Sha256: 40ac7cf7c234f164a442362d6320847560ce21db9849a192b9a50363e93bfa82
Contents?: true
Size: 595 Bytes
Versions: 3
Compression:
Stored size: 595 Bytes
Contents
require 'spec_helper' module Sexpr::Matcher describe NonTerminal, "eat" do let(:defn){ Sequence.new [Terminal.new(/^[a-z]+$/)] } let(:rule){ NonTerminal.new :hello, defn } subject{ rule.eat(sexpr) } context 'when match' do let(:sexpr){ [[:hello, "world"], "!"] } it{ should eq(["!"]) } end [ [:hello, "world"], [:hello], [], [[]], [nil], ].each do |example| context "when no match, e.g. #{example.inspect}" do let(:sexpr){ example } it{ should be_nil } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sexpr-1.1.0 | spec/unit/matcher/non_terminal/test_eat.rb |
sexpr-1.0.0 | spec/unit/matcher/non_terminal/test_eat.rb |
sexpr-0.6.0 | spec/unit/matcher/non_terminal/test_eat.rb |