Sha256: fce6353513284741e5035e5e010cae89fc3439137195cb6b02eaddccaf410770

Contents?: true

Size: 1.14 KB

Versions: 253

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

module AndPredicateSpec
  describe "An &-predicated terminal symbol" do
    testing_expression '&"foo"'

    it "successfully parses input matching the terminal symbol, returning an epsilon syntax node" do
      parse('foo', :consume_all_input => false) do |result|
        result.should_not be_nil
        result.interval.should == (0...0)
      end
    end
  end

  describe "A sequence of a terminal and an and another &-predicated terminal" do
    testing_expression '"foo" &"bar"'

    it "matches input matching both terminals, but only consumes the first" do
      parse('foobar', :consume_all_input => false) do |result|
        result.should_not be_nil
        result.text_value.should == 'foo'
      end
    end
  
    it "fails to parse input matching only the first terminal, with a terminal failure recorded at index 3" do
      parse('foo') do |result|
        result.should be_nil
        terminal_failures = parser.terminal_failures
        terminal_failures.size.should == 1
        failure = terminal_failures[0]
        failure.index.should == 3
        failure.expected_string.should == 'bar'
      end
    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/and_predicate_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/and_predicate_spec.rb