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.1.5 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.6 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.7 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.8 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.1.9 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.2.0 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.2.1 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.2.2 lib/vendor/treetop/spec/compiler/grammar_spec.rb
cloudhead-less-1.2.3 lib/vendor/treetop/spec/compiler/grammar_spec.rb
nirvdrum-less-1.1.4 lib/vendor/treetop/spec/compiler/grammar_spec.rb
skylinecms-3.1.0 vendor/digitpaint/personify/vendor/treetop/spec/compiler/grammar_spec.rb
personify-1.0.0 vendor/treetop/spec/compiler/grammar_spec.rb
westarete-skylinecms-3.0.8.20100329 vendor/digitpaint/personify/vendor/treetop/spec/compiler/grammar_spec.rb
westarete-skylinecms-3.0.8.20100330 vendor/digitpaint/personify/vendor/treetop/spec/compiler/grammar_spec.rb
mail-2.1.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-2.1.2 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-2.1.1 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-2.1.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-2.0.5 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-2.0.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb