Sha256: 74ea8ea4467294327cefdfeb28d00c213c2eee385a2af8eb7f748ef7514e7d63

Contents?: true

Size: 481 Bytes

Versions: 2

Compression:

Stored size: 481 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
sexpr-1.1.0 spec/unit/matcher/reference/test_match_q.rb
sexpr-1.0.0 spec/unit/matcher/reference/test_match_q.rb