Sha256: 92452d54bd98bf8e3601289efc66616f49c501cb9f034733a294f040dc70160b

Contents?: true

Size: 1.1 KB

Versions: 76

Compression:

Stored size: 1.1 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")

module NotPredicateSpec
  describe "A !-predicated terminal symbol" do
    testing_expression '!"foo"'

    it "fails to parse input matching the terminal symbol" do
      parse('foo').should be_nil
    end
  end

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

    it "fails to match input matching both terminals" do
      parse('foobar').should be_nil
    end
  
    it "successfully parses input matching the first terminal and not the second, reporting the parse failure of the second terminal" do
      parse('foo') do |result|
        result.should_not be_nil
        terminal_failures = parser.terminal_failures
        terminal_failures.size.should == 1
        failure = terminal_failures.first
        failure.index.should == 3
        failure.expected_string.should == 'bar'
      end
    end
  end

  describe "A !-predicated sequence" do
    testing_expression '!("a" "b" "c")'

    it "fails to parse matching input" do
      parse('abc').should be_nil
    end
  end
end

Version data entries

76 entries across 76 versions & 7 rubygems

Version Path
cloudhead-less-1.1.5 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.1.6 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.1.7 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.1.8 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.1.9 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.2.0 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.2.1 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.2.2 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
cloudhead-less-1.2.3 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
nirvdrum-less-1.1.4 lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
skylinecms-3.1.0 vendor/digitpaint/personify/vendor/treetop/spec/compiler/not_predicate_spec.rb
personify-1.0.0 vendor/treetop/spec/compiler/not_predicate_spec.rb
westarete-skylinecms-3.0.8.20100329 vendor/digitpaint/personify/vendor/treetop/spec/compiler/not_predicate_spec.rb
westarete-skylinecms-3.0.8.20100330 vendor/digitpaint/personify/vendor/treetop/spec/compiler/not_predicate_spec.rb
mail-2.1.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/not_predicate_spec.rb
mail-2.1.2 lib/mail/vendor/treetop-1.4.3/spec/compiler/not_predicate_spec.rb
mail-2.1.1 lib/mail/vendor/treetop-1.4.3/spec/compiler/not_predicate_spec.rb
mail-2.1.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/not_predicate_spec.rb
mail-2.0.5 lib/mail/vendor/treetop-1.4.3/spec/compiler/not_predicate_spec.rb
mail-2.0.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/not_predicate_spec.rb