RFR: JDK-8292990 Improve test coverage for XPath Axes: parent
Joe Wang
joehw at openjdk.org
Thu Sep 1 17:33:28 UTC 2022
On Wed, 31 Aug 2022 20:16:33 GMT, Bill Huang <duke at openjdk.org> wrote:
> The goal of this task is validating the parent axis contains the parent of the context node. Context nodes include
> - root node
> - element nodes
> - text nodes
> - attribute nodes
> - namespace nodes
> - comment nodes
test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpParentTest.java line 56:
> 54: return new Object[][]{
> 55: {"//Customer/parent::*", "//Customers"},
> 56: {"//Customer[1]/text()/parent::*", "//Customer"},
I see that the 2nd parameter meant to be the parent, it thus needs to return a single and unique node. But "//Customer" may return multiple nodes.
test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpParentTest.java line 86:
> 84:
> 85: // parent of document root
> 86: {"/.."},
The nature of these two statements seems to be quite different. It might be worth to explain a bit more, a reference to the spec or note from the Slack discussion, sth. that might help the reader of these tests.
test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpParentTest.java line 145:
> 143:
> 144: /**
> 145: * Verifies that XPath relative expressions provide a parent node.
The context node happens to be the parent node of the 2nd statement. Needs to document it in the description and the params below.
-------------
PR: https://git.openjdk.org/jdk/pull/10107
More information about the core-libs-dev
mailing list