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
mail-1.6.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.5.4 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.5.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.5.2 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.5.1 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.5.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.4.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.4.2 lib/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.4.1 lib/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.4.0 lib/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
mail-1.3.5 lib/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
skylinecms-3.0.8 vendor/digitpaint/personify/vendor/treetop/spec/compiler/grammar_spec.rb
mail-1.3.4 lib/vendor/treetop-1.4.3/spec/compiler/grammar_spec.rb
skylinecms-3.0.7 vendor/digitpaint/personify/vendor/treetop/spec/compiler/grammar_spec.rb
less-1.1.13 lib/vendor/treetop/spec/compiler/grammar_spec.rb
less-1.0.4 lib/vendor/treetop/spec/compiler/grammar_spec.rb
less-1.0.5 lib/vendor/treetop/spec/compiler/grammar_spec.rb
less-1.0.6 lib/vendor/treetop/spec/compiler/grammar_spec.rb
less-1.0.8 lib/vendor/treetop/spec/compiler/grammar_spec.rb
less-1.0.9 lib/vendor/treetop/spec/compiler/grammar_spec.rb