Sha256: 1a242405009512456d02dec04d3fe3c1a0bcb1116afb5e042e5d95860687378b
Contents?: true
Size: 968 Bytes
Versions: 1
Compression:
Stored size: 968 Bytes
Contents
require 'spec_helper' module Sexpr module Grammar describe Matching, "compile_rules" do include Matching let(:yaml){ <<-YAML bool_and: - [ bool_lit, bool_lit ] bool_lit: - true - false var_name: !ruby/regexp /^[a-z]+$/ YAML } let(:rules){ YAML.load(yaml) } subject{ compile_rules(rules) } it{ should be_a(Hash) } it 'has expected keys' do subject.keys.should eq([:bool_and, :bool_lit, :var_name]) end it 'has expected values' do subject.values.each do |val| val.should be_a(Matcher::Rule) end end it 'has expected defn' do subject[:bool_and].defn.should be_a(Matcher::NonTerminal) subject[:bool_lit].defn.should be_a(Matcher::Alternative) subject[:var_name].defn.should be_a(Matcher::Terminal) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sexpr-0.6.0 | spec/unit/grammar/matching/test_compile_rules.rb |