Sha256: 1343415fa9e12d0658625b56046ef91af5345b4369f283231dd845110890bf3d

Contents?: true

Size: 848 Bytes

Versions: 76

Compression:

Stored size: 848 Bytes

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")

module GrammarSpec
  module Bar
  end

  describe "a grammar" do
    testing_grammar %{
      grammar Foo
              # This comment should not cause a syntax error, nor should the following empty one
              #
        include GrammarSpec::Bar

        rule foo
          bar / baz
        end

        rule bar
          'bar' 'bar'
        end

        rule baz
          'baz' 'baz'
        end
      end
    }

    it "parses matching input" do
      parse('barbar').should_not be_nil
      parse('bazbaz').should_not be_nil
    end

    it "fails if it does not parse all input" do
      parse('barbarbazbaz').should be_nil
    end

    it "mixes in included modules" do
      self.class.const_get(:Foo).ancestors.should include(GrammarSpec::Bar)
    end
  end
end

Version data entries

76 entries across 76 versions & 7 rubygems

Version Path
cloudhead-less-1.0.1 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.10 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.13 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.16 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.2 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.3 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.4 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.5 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.6 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.8 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.0.9 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.0 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.1 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.10 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.11 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.12 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.13 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.2 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.3 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.4 lib/vendor/treetop/spec/compiler/grammar_spec.rb