Sha256: 6eef6efb27d3febd70b0c98566db4d967e75691120bd837ae3b15d34f1921a10

Contents?: true

Size: 1.17 KB

Versions: 53

Compression:

Stored size: 1.17 KB

Contents

require_relative '../../spec_helper'

require_relative '../support/grammar_abc_helper'


# Load the class under test
require_relative '../../../lib/rley/ptree/parse_tree'

module Rley # Open this namespace to avoid module qualifier prefixes
  module PTree # Open this namespace to avoid module qualifier prefixes
    describe ParseTree do
      include GrammarABCHelper # Mix-in module with builder for grammar abc

      let(:sample_grammar) do
        builder = grammar_abc_builder
        builder.grammar
      end

      let(:sample_prod) { sample_grammar.rules[0] }
      let(:sample_range) { { low: 0, high: 5 } }
      let(:sample_root) { ParseTreeNode.new(sample_prod.lhs, sample_range) }

      subject do
        ParseTree.new(sample_root)
      end

      context 'Initialization:' do
        it 'should be created with a root node' do
          expect { ParseTree.new(sample_root) }.not_to raise_error
        end

        it 'should know its root node' do
          its_root = subject.root
          expect(its_root.symbol.name).to eq('S')
          expect(its_root.range).to eq(sample_range)
        end
      end # context
    end # describe
  end # module
end # module

# End of file

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
rley-0.7.03 spec/rley/ptree/parse_tree_spec.rb
rley-0.7.02 spec/rley/ptree/parse_tree_spec.rb
rley-0.7.01 spec/rley/ptree/parse_tree_spec.rb
rley-0.7.00 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.09 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.08 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.07 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.06 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.05 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.04 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.03 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.02 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.01 spec/rley/ptree/parse_tree_spec.rb
rley-0.6.00 spec/rley/ptree/parse_tree_spec.rb
rley-0.5.14 spec/rley/ptree/parse_tree_spec.rb
rley-0.5.13 spec/rley/ptree/parse_tree_spec.rb
rley-0.5.12 spec/rley/ptree/parse_tree_spec.rb
rley-0.5.11 spec/rley/ptree/parse_tree_spec.rb
rley-0.5.10 spec/rley/ptree/parse_tree_spec.rb
rley-0.5.09 spec/rley/ptree/parse_tree_spec.rb