Sha256: 42802fadaf2d604847066cbd4940442a85ff4252ff2bf8814d9b9fb8e73894fb

Contents?: true

Size: 1.26 KB

Versions: 253

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

module TerminalSymbolSpec
  class Foo < Treetop::Runtime::SyntaxNode
  end

  describe "a terminal symbol followed by a node class declaration and a block" do
    testing_expression "'foo' <TerminalSymbolSpec::Foo> { def a_method; end }"

    it "correctly parses matching input prefixes at various indices, returning an instance of the declared class that can respond to methods defined in the inline module" do
      parse "foo", :index => 0 do |result|
        result.should be_an_instance_of(Foo)
        result.should respond_to(:a_method)
        result.interval.should == (0...3)
        result.text_value.should == 'foo'
      end

      parse "xfoo", :index => 1 do |result|
        result.should be_an_instance_of(Foo)
        result.should respond_to(:a_method)
        result.interval.should == (1...4)
        result.text_value.should == 'foo'
      end
    
      parse "---foo", :index => 3 do |result|
        result.should be_an_instance_of(Foo)
        result.should respond_to(:a_method)
        result.interval.should == (3...6)
        result.text_value.should == 'foo'
      end
    end

    it "fails to parse nonmatching input at the index even if a match occurs later" do
      parse(" foo", :index =>  0).should be_nil
    end
  end
end

Version data entries

253 entries across 208 versions & 31 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/terminal_symbol_spec.rb