Sha256: 980a7c76529fc529b14debeaf52c9557e85c6657cd56a021a51d85bae9b3a9b7

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

require 'spec_helper'
module Sexpr
  describe Rule, 'match?' do

    let(:defn){ Sequence.new [Terminal.new(/^[a-z]+$/)] }
    let(:rule){ Rule.new :hello, defn }

    it 'returns true on match' do
      rule.should be_match([:hello, "hello"])
    end

    it 'returns false on partial match' do
      rule.should_not be_match([:hello, "hello", "world"])
    end

    it 'returns false on no match' do
      rule.should_not be_match(["hello"])
      rule.should_not be_match([:hello, 12])
      rule.should_not be_match([])
      rule.should_not be_match(nil)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sexpr-0.2.0 spec/rule/test_match_q.rb