Sha256: de903936eefe2356896a1d4d5742334869708e5385a2b156e252712be1bb23e2

Contents?: true

Size: 1.65 KB

Versions: 6

Compression:

Stored size: 1.65 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
  
  describe "an anything symbol" do
    testing_expression '.'
    it "matches an UTF-8 character" do
      parse("ΓΈ").should_not be_nil
    end
  end
  
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
skylinecms-3.1.0 vendor/digitpaint/personify/vendor/treetop/spec/compiler/anything_symbol_spec.rb
personify-1.0.0 vendor/treetop/spec/compiler/anything_symbol_spec.rb
westarete-skylinecms-3.0.8.20100329 vendor/digitpaint/personify/vendor/treetop/spec/compiler/anything_symbol_spec.rb
westarete-skylinecms-3.0.8.20100330 vendor/digitpaint/personify/vendor/treetop/spec/compiler/anything_symbol_spec.rb
skylinecms-3.0.8 vendor/digitpaint/personify/vendor/treetop/spec/compiler/anything_symbol_spec.rb
skylinecms-3.0.7 vendor/digitpaint/personify/vendor/treetop/spec/compiler/anything_symbol_spec.rb