Support for lexing empty XPath strings.

This commit is contained in:
Yorick Peterse committed 2014-08-25 09:42:51 +02:00
1 parent b688c6dc1b
commit 276a5ab83b
2 files changed
+23 -2

No files matched your search

+2 -2
View File
@@ -201,8 +201,8 @@ module Oga
dquote = '"';
squote = "'";
string_dquote = (dquote ^dquote+ dquote);
string_squote = (squote ^squote+ squote);
string_dquote = (dquote ^dquote* dquote);
string_squote = (squote ^squote* squote);
string = string_dquote | string_squote;
+21
View File
@@ -0,0 +1,21 @@
require 'spec_helper'
describe Oga::XPath::Lexer do
context 'strings' do
example 'lex a double quoted string' do
lex_xpath('"foo"').should == [[:T_STRING, 'foo']]
end
example 'lex a single quoted string' do
lex_xpath("'foo'").should == [[:T_STRING, 'foo']]
end
example 'lex an empty double quoted string' do
lex_xpath('""').should == [[:T_STRING, '']]
end
example 'lex an empty single quoted string' do
lex_xpath("''").should == [[:T_STRING, '']]
end
end
end