From f2fe2a4b478ed9bffa161e230647b1c2587fc964 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 13 Aug 2014 00:37:12 +0200 Subject: [PATCH] Failing XPath spec for double slashes. The lexer doesn't lex things correctly due to "//" and "/" both being separate rules. As a result the lexer emits two T_SLASH tokens for queries such as ".//foo". --- spec/oga/xpath/lexer/axes_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/oga/xpath/lexer/axes_spec.rb b/spec/oga/xpath/lexer/axes_spec.rb index 25327c8..d804cdc 100644 --- a/spec/oga/xpath/lexer/axes_spec.rb +++ b/spec/oga/xpath/lexer/axes_spec.rb @@ -147,5 +147,16 @@ describe Oga::XPath::Lexer do [:T_RPAREN, nil], ] end + + example 'lex the . axis followed by a path' do + lex_xpath('./foo').should == [ + [:T_AXIS, 'self'], + [:T_IDENT, 'node'], + [:T_LPAREN, nil], + [:T_RPAREN, nil], + [:T_SLASH, nil], + [:T_IDENT, 'foo'] + ] + end end end