Sha256: 6a62f20b77bf6296d7ace2b0bacb4a850e3073c0f784c194cbfce28b9de23bdf

Contents?: true

Size: 1.5 KB

Versions: 18

Compression:

Stored size: 1.5 KB

Contents

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

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

  describe "an anything symbol followed by a node class declaration and a block" do
    testing_expression '. <AnythingSymbolSpec::Foo> { def a_method; end }'
  
    it "matches any single character in a big range, returning an instance of the declared node class that responds to methods defined in the inline module" do
      (33..127).each do |digit|
        parse(digit.chr) do |result|
          result.should_not be_nil
          result.should be_an_instance_of(Foo)
          result.should respond_to(:a_method)
          result.interval.should == (0...1)
        end
      end
    end
  
    it "fails to parse epsilon" do
      parse('').should be_nil
    end
  end
    
  module ModFoo
  end

  describe "an anything symbol followed by a module declaration and a block" do
    testing_expression '. <AnythingSymbolSpec::ModFoo> { def a_method; end }'
  
    it "matches any single character in a big range, returning an instance of SyntaxNode extended by the declared module that responds to methods defined in the inline module" do
      (33..127).each do |digit|
        parse(digit.chr) do |result|
          result.should_not be_nil
          result.should be_an_instance_of(Treetop::Runtime::SyntaxNode)
          result.should be_a_kind_of(ModFoo)
          result.should respond_to(:a_method)
          result.interval.should == (0...1)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mail-2.1.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-2.1.2 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-2.1.1 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-2.1.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-2.0.5 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-2.0.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.6.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.5.4 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.5.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.5.2 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.5.1 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.5.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.4.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.4.2 lib/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.4.1 lib/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.4.0 lib/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.3.5 lib/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb
mail-1.3.4 lib/vendor/treetop-1.4.3/spec/compiler/anything_symbol_spec.rb