Sha256: 36f7d0e29b5af0d8e3329caa674ca763c168879966dcad451223c46306376319

Contents?: true

Size: 459 Bytes

Versions: 1

Compression:

Stored size: 459 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

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