Sha256: 69998638867c1120f530ccf4777e538c20942073ff408a70a8cc9a06b34befe3

Contents?: true

Size: 1.03 KB

Versions: 76

Compression:

Stored size: 1.03 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../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

76 entries across 76 versions & 7 rubygems

Version Path
less-1.0.10 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.0.11 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.0.12 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.0.13 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.0.14 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.0.15 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.0.16 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.3 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.5 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.6 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.7 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.8 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.9 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.10 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.11 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
less-1.1.12 lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb