Sha256: ba220ff2cfe728d5500417d6b0821218bac481cfd9af439ee02df8618f582c9f

Contents?: true

Size: 470 Bytes

Versions: 1

Compression:

Stored size: 470 Bytes

Contents

require 'spec_helper'
module Sexpr
  describe Reference, "match?" do

    let(:grammar){ {:hello => Terminal.new(/^[a-z]+$/)} }
    let(:rule)   { Reference.new :hello, grammar        }

    it 'returns true on match' do
      rule.should be_match("hello")
      (rule === "hello").should be_true
    end

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