Sha256: 6c22cba7f5d0fe5a23836e10adc5ef61b0f7d5d7d954e60129c0ebd6fd3d7983

Contents?: true

Size: 1008 Bytes

Versions: 262

Compression:

Stored size: 1008 Bytes

Contents

require 'spec_helper'

module NonterminalSymbolSpec
  describe "A nonterminal symbol followed by a block" do
    testing_expression 'foo { def a_method; end }'
  
    parser_class_under_test.class_eval do
      def _nt_foo
        '_nt_foo called'
      end
    end
  
    it "compiles to a method call, extending its results with the anonymous module for the block" do
      result = parse('')
      result.should == '_nt_foo called'
      result.should respond_to(:a_method)
    end
  end

  module TestModule
    def a_method
    end
  end

  describe "a non-terminal followed by a module declaration" do
    testing_expression 'foo <NonterminalSymbolSpec::TestModule>'
  
    parser_class_under_test.class_eval do
      def _nt_foo
        '_nt_foo called'
      end
    end
  
    it "compiles to a method call, extending its results with the anonymous module for the block" do
      result = parse('')
      result.should == '_nt_foo called'
      result.should respond_to(:a_method)
    end
  end
end

Version data entries

262 entries across 217 versions & 32 rubygems

Version Path
mail-2.1.5.1 lib/mail/vendor/treetop-1.4.4/spec/compiler/nonterminal_symbol_spec.rb
mail-2.1.5 lib/mail/vendor/treetop-1.4.3/spec/compiler/nonterminal_symbol_spec.rb