Sha256: de7ac0605a6ebddf30b460d616cbf1c9be4c5505af828d37eb506477c470bbcd
Contents?: true
Size: 818 Bytes
Versions: 6
Compression:
Stored size: 818 Bytes
Contents
# # specifying raabro # # Tue Sep 22 07:55:52 JST 2015 # require 'spec_helper' describe Raabro::Tree do describe '.lookup' do it 'returns the first node with the given name' do t = Sample::Cal.parse('4 5 6 + 1 2 3 * +') expect( t.lookup('item').to_a(:leaves) ).to eq( [ :item, 1, 0, 1, nil, :alt, [ [ :num, 1, 0, 1, nil, :rex, '4' ] ] ] ) end end describe '.gather' do it 'returns all the nodes with a given name' do t = Sample::Cal.parse('4 5 6 + 1 2 3 * +') expect( t.gather('op').collect { |n| n.to_a(:leaves) } ).to eq( [ [ :op, 1, 6, 1, nil, :rex, '+' ], [ :op, 1, 14, 1, nil, :rex, '*' ], [ :op, 1, 16, 1, nil, :rex, '+' ] ] ) end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
raabro-1.0.5 | spec/tree_spec.rb |
raabro-1.0.4 | spec/tree_spec.rb |
raabro-1.0.3 | spec/tree_spec.rb |
raabro-1.0.2 | spec/tree_spec.rb |
raabro-1.0.1 | spec/tree_spec.rb |
raabro-1.0.0 | spec/tree_spec.rb |