Sha256: e649fa58055b5963a51a3e09c5d6e5fa0847bb6a53fdfc1437dea34614962410

Contents?: true

Size: 554 Bytes

Versions: 7

Compression:

Stored size: 554 Bytes

Contents

require 'spec_helper'
module Sexpr::Matcher
  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

7 entries across 7 versions & 1 rubygems

Version Path
sexpr-1.1.0 spec/unit/matcher/many/test_match_q.rb
sexpr-1.0.0 spec/unit/matcher/many/test_match_q.rb
sexpr-0.6.0 spec/unit/matcher/many/test_match_q.rb
sexpr-0.5.1 spec/matcher/many/test_match_q.rb
sexpr-0.5.0 spec/matcher/many/test_match_q.rb
sexpr-0.4.0 spec/matcher/many/test_match_q.rb
sexpr-0.3.0 spec/matcher/many/test_match_q.rb