XPath lexer test for predicates using axes.

This commit is contained in:
Yorick Peterse 2014-06-01 19:49:37 +02:00
parent 88b06e247d
commit b7855c124f
1 changed files with 13 additions and 0 deletions

View File

@ -126,6 +126,19 @@ describe Oga::XPath::Lexer do
]
end
example 'lex a predicate expression using axes' do
lex_xpath('/div[/foo/bar]').should == [
[:T_SLASH, nil],
[:T_IDENT, 'div'],
[:T_LBRACK, nil],
[:T_SLASH, nil],
[:T_IDENT, 'foo'],
[:T_SLASH, nil],
[:T_IDENT, 'bar'],
[:T_RBRACK, nil]
]
end
# The following are a bunch of examples taken from Wikipedia and the W3 spec
# to see how the lexer handles them.