spec/rley/parser/chart_spec.rb in rley-0.2.09 vs spec/rley/parser/chart_spec.rb in rley-0.2.10
- old
+ new
@@ -19,22 +19,23 @@
let(:dotted_rule) { double('fake-dotted-item') }
let(:output) { StringIO.new('', 'w') }
let(:token_seq) do
- literals = ['I', 'saw', 'John', 'with', 'a', 'dog']
- literals.map {|lexeme| Token.new(lexeme, nil)}
+ literals = %w(I saw John with a dog)
+ literals.map { |lexeme| Token.new(lexeme, nil) }
end
let(:sample_tracer) { ParseTracer.new(0, output, token_seq) }
context 'Initialization:' do
# Default instantiation rule
subject { Chart.new(dotted_rule, count_token, sample_tracer) }
it 'should be created with start dotted rule, token count, tracer' do
- expect { Chart.new(dotted_rule, count_token, sample_tracer) }.not_to raise_error
+ expect { Chart.new(dotted_rule, count_token, sample_tracer) }
+ .not_to raise_error
end
it 'should have a seed state in first state_set' do
seed_state = ParseState.new(dotted_rule, 0)
expect(subject[0].states).to eq([seed_state])
@@ -89,10 +90,9 @@
['I', 'saw', 'John', 'with', 'a', 'dog']
|. I . saw . John . with . a . dog .|
|> . . . . . .| [0:0] sentence => A B . C
SNIPPET
expect(output.string).to eq(expectation)
-
end
it 'should trace parse state pushing' do
subject[0] # Force constructor call here
output.string = ''