Sha256: 777275c78d6a9f7ca6a1cce9d1642f856f93e14c4843adf375773c7b788bde00

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

require 'spec_helper'
module Sexpr
  describe Many do

    let(:term){ Terminal.new(/^[a-z]+$/) }
    let(:rule){ Many.new term, '+'       }

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

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

    it 'returns false on no match' do
      rule.should_not be_match(["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/many/test_match_q.rb