spec/rley/parser/error_reason_spec.rb in rley-0.6.09 vs spec/rley/parser/error_reason_spec.rb in rley-0.7.00

- old
+ new

@@ -60,11 +60,12 @@ end # describe describe UnexpectedToken do let(:err_lexeme) { '-' } let(:err_terminal) { Syntax::Terminal.new('MINUS') } - let(:err_token) { Lexical::Token.new(err_lexeme, err_terminal) } + let(:pos) { Lexical::Position.new(3, 4) } + let(:err_token) { Lexical::Token.new(err_lexeme, err_terminal, pos) } let(:terminals) do %w[PLUS LPAREN].map { |name| Syntax::Terminal.new(name) } end # Default instantiation rule @@ -79,11 +80,11 @@ end # context context 'Provided services:' do it 'should emit a message' do text = <<MESSAGE_END -Syntax error at or near token 4 >>>-<<< +Syntax error at or near token line 3, column 4 >>>-<<< Expected one of: ['PLUS', 'LPAREN'], found a 'MINUS' instead. MESSAGE_END expect(subject.to_s).to eq(text.chomp) expect(subject.message).to eq(text.chomp) end @@ -91,11 +92,12 @@ end # describe describe PrematureInputEnd do let(:err_lexeme) { '+' } let(:err_terminal) { Syntax::Terminal.new('PLUS') } - let(:err_token) { Lexical::Token.new(err_lexeme, err_terminal) } + let(:pos) { Lexical::Position.new(3, 4) } + let(:err_token) { Lexical::Token.new(err_lexeme, err_terminal, pos) } let(:terminals) do %w[INT LPAREN].map { |name| Syntax::Terminal.new(name) } end # Default instantiation rule @@ -110,10 +112,10 @@ end # context context 'Provided services:' do it 'should emit a message' do text = <<MESSAGE_END -Premature end of input after '+' at position 4 +Premature end of input after '+' at position line 3, column 4 Expected one of: ['INT', 'LPAREN']. MESSAGE_END expect(subject.to_s).to eq(text.chomp) expect(subject.message).to eq(text.chomp) end