Sha256: 54c017952d048bad86236e4cd71b6d319e1e6c4644b2130d42b9f7ca7edd07db

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'test_helper')

class GrammarTest < CompilerTestCase
  module Bar
  end

  testing_grammar %{
    grammar Foo
      include 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 be_success
    parse('bazbaz').should be_success
  end
  
  it "fails if it does not parse all input" do
    parse('barbarbazbaz').should be_failure
  end
  
  it "mixes in included modules" do
    Foo.ancestors.should include(Bar)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
treetop-1.1.0 test/compiler/grammar_test.rb
treetop-1.1.2 test/compiler/grammar_test.rb
treetop-1.0.1 test/compiler/grammar_test.rb
treetop-1.0.2 test/compiler/grammar_test.rb
treetop-1.1.1 test/compiler/grammar_test.rb