From 27ffa4d3d5c5c6dd02f9162cf5ebbaf8ce761c9c Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 13 Nov 2014 01:11:13 +0100 Subject: [PATCH] Added various failing following/preceding specs. --- spec/oga/xpath/evaluator/axes/following_sibling_spec.rb | 5 +++++ spec/oga/xpath/evaluator/axes/following_spec.rb | 6 ++++++ spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb | 5 +++++ spec/oga/xpath/evaluator/axes/preceding_spec.rb | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb b/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb index ae5e6c2..0eadcce 100644 --- a/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb +++ b/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb @@ -16,6 +16,7 @@ describe Oga::XPath::Evaluator do EOF + @bar1 = @document.children[0].children[0].children[0] @baz1 = @document.children[0].children[0].children[1] @baz2 = @baz1.children[0] @baz3 = @document.children[0].children[1] @@ -36,5 +37,9 @@ describe Oga::XPath::Evaluator do evaluate_xpath(@document, 'root/foo/bar/following-sibling::baz') .should == node_set(@baz1) end + + example 'return a node set containing the siblings relative to root/foo/bar' do + evaluate_xpath(@bar1, 'following-sibling::baz').should == node_set(@baz1) + end end end diff --git a/spec/oga/xpath/evaluator/axes/following_spec.rb b/spec/oga/xpath/evaluator/axes/following_spec.rb index 27f5c00..9fa623f 100644 --- a/spec/oga/xpath/evaluator/axes/following_spec.rb +++ b/spec/oga/xpath/evaluator/axes/following_spec.rb @@ -16,6 +16,7 @@ describe Oga::XPath::Evaluator do EOF + @bar1 = @document.children[0].children[0].children[0] @baz1 = @document.children[0].children[0].children[1] @baz2 = @baz1.children[0] @baz3 = @document.children[0].children[1] @@ -36,5 +37,10 @@ describe Oga::XPath::Evaluator do evaluate_xpath(@document, 'root/foo/bar/following::baz') .should == node_set(@baz1, @baz2, @baz3) end + + example 'return a node set containing the siblings relative to root/foo/bar' do + evaluate_xpath(@bar1, 'following::baz') + .should == node_set(@baz1, @baz2, @baz3) + end end end diff --git a/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb b/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb index 8cb0e4c..d86fe3e 100644 --- a/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb +++ b/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb @@ -16,6 +16,7 @@ describe Oga::XPath::Evaluator do @foo1 = @document.children[0].children[0] @foo2 = @document.children[0].children[1].children[0] + @bar1 = @document.children[0].children[1] end example 'return a node set containing preceding siblings of root/bar' do @@ -27,5 +28,9 @@ describe Oga::XPath::Evaluator do evaluate_xpath(@document, 'root/bar/baz/preceding-sibling::foo') .should == node_set(@foo2) end + + example 'return a node set containing preceding siblings relative to root/bar' do + evaluate_xpath(@bar1, 'preceding-sibling::foo').should == node_set(@foo1) + end end end diff --git a/spec/oga/xpath/evaluator/axes/preceding_spec.rb b/spec/oga/xpath/evaluator/axes/preceding_spec.rb index b302590..5ee0e87 100644 --- a/spec/oga/xpath/evaluator/axes/preceding_spec.rb +++ b/spec/oga/xpath/evaluator/axes/preceding_spec.rb @@ -19,6 +19,7 @@ describe Oga::XPath::Evaluator do @bar1 = @foo1.children[0] @baz1 = @foo1.children[1] @baz2 = @baz1.children[0] + @baz3 = @document.children[0].children[1] end example 'return a node set containing preceding nodes of root/foo/baz' do @@ -30,5 +31,9 @@ describe Oga::XPath::Evaluator do evaluate_xpath(@document, 'root/baz/preceding::baz') .should == node_set(@baz1, @baz2) end + + example 'return a node set containing preceding nodes relative to root/baz' do + evaluate_xpath(@baz3, 'preceding::baz').should == node_set(@baz1, @baz2) + end end end