Added spec for not() in a predicate
This commit is contained in:
parent
0dcee637d3
commit
8e60c69def
|
@ -4,22 +4,32 @@ describe Oga::XPath::Compiler do
|
||||||
describe 'not() function' do
|
describe 'not() function' do
|
||||||
before do
|
before do
|
||||||
@document = parse('<root>foo</root>')
|
@document = parse('<root>foo</root>')
|
||||||
|
|
||||||
|
@root = @document.children[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns false when the argument is a non-zero integer' do
|
describe 'at the top-level' do
|
||||||
evaluate_xpath(@document, 'not(10)').should == false
|
it 'returns false when the argument is a non-zero integer' do
|
||||||
|
evaluate_xpath(@document, 'not(10)').should == false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns true when the argument is a zero integer' do
|
||||||
|
evaluate_xpath(@document, 'not(0)').should == true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false when the argument is a non-empty node set' do
|
||||||
|
evaluate_xpath(@document, 'not(root)').should == false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns itrue when the argument is an empty node set' do
|
||||||
|
evaluate_xpath(@document, 'not(foo)').should == true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true when the argument is a zero integer' do
|
describe 'in a predicate' do
|
||||||
evaluate_xpath(@document, 'not(0)').should == true
|
it 'returns a NodeSet containing all matching nodes ' do
|
||||||
end
|
evaluate_xpath(@document, 'root[not(node())]').should == node_set(@root)
|
||||||
|
end
|
||||||
it 'returns false when the argument is a non-empty node set' do
|
|
||||||
evaluate_xpath(@document, 'not(root)').should == false
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns itrue when the argument is an empty node set' do
|
|
||||||
evaluate_xpath(@document, 'not(foo)').should == true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue