Sha256: 59e2e1c31c3b82ded180bfd00dc1fba199703fdfed046e5f66d4600b2012aa3f

Contents?: true

Size: 404 Bytes

Versions: 1

Compression:

Stored size: 404 Bytes

Contents

require 'spec_helper'
module Sexpr
  describe Grammar, "root" do

    let(:rules){ {:t => /[a-z]+/, :nt => true} }

    def grammar(options = {})
      Sexpr.load(rules, options)
    end

    it 'is the first key by default' do
      grammar.root.value.should eq(/[a-z]+/)
    end

    it 'is the specified rule when specified' do
      grammar(:root => :nt).root.value.should eq(true)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sexpr-0.2.0 spec/grammar/test_root.rb