Sha256: 69bd6fc52c98d0fa27b21e5e2d36a199d651fb57d4ef03cd638f8a982fe58a0f
Contents?: true
Size: 468 Bytes
Versions: 7
Compression:
Stored size: 468 Bytes
Contents
require 'spec_helper' module Sexpr::Matcher describe Alternative, "match?" do let(:alt1){ Terminal.new(nil) } let(:alt2){ Terminal.new(/^[a-z]+$/) } let(:rule){ Alternative.new [alt1, alt2] } it 'returns true if one matches' do rule.should be_match("hello") rule.should be_match(nil) end it 'returns false on no match' do rule.should_not be_match("12") rule.should_not be_match([]) end end end
Version data entries
7 entries across 7 versions & 1 rubygems