Sha256: d3ec83b425ba7af01907483fc4fdc66bfad3a74afd31fbd7f55ad8300756431a

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

require 'spec_helper'
module Sexpr
  class Grammar; public :compile_rule; end
  describe Grammar, "compile_rule" do

    def compile(name, arg)
      Grammar.new.compile_rule(name, arg)
    end

    it 'keep alternatives unchanged' do
      compile(:hello, Alternative.new([]) ).should be_a(Alternative)
    end

    it 'keep terminals unchanged' do
      compile(:hello, Terminal.new(true) ).should be_a(Terminal)
    end

    it 'keep creates a Rule englobing sequences' do
      compiled = compile(:hello, Sequence.new([]) )
      compiled.should be_a(Rule)
      compiled.name.should eq(:hello)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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