Sha256: eec69fc88276395adce834d2c48b1d48774755c37727229957e83d4352490ecd

Contents?: true

Size: 1.09 KB

Versions: 253

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

module OptionalSpec
  describe "An optional terminal symbol" do
    testing_expression '"foo"?'
  
    it "parses input matching the terminal" do
      parse('foo').should_not be_nil
    end
  
    it "parses epsilon, recording a failure" do
      parse('') do |result|
        result.should_not be_nil
        result.interval.should == (0...0)
        
        terminal_failures = parser.terminal_failures
        terminal_failures.size.should == 1
        failure = terminal_failures.first
        failure.index.should == 0
        failure.expected_string.should == 'foo'
      end
    end
  
    it "parses input not matching the terminal, returning an epsilon result and recording a failure" do
      parse('bar', :consume_all_input => false) do |result|
        result.should_not be_nil
        result.interval.should == (0...0)
        
        terminal_failures = parser.terminal_failures
        terminal_failures.size.should == 1
        failure = terminal_failures.first
        failure.index.should == 0
        failure.expected_string.should == 'foo'
      end
    end
  end
end

Version data entries

253 entries across 208 versions & 31 rubygems

Version Path
logstash-output-scalyr-0.1.9 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/treetop-1.4.15/spec/compiler/optional_spec.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/treetop-1.4.15/spec/compiler/optional_spec.rb