RFR: JDK-8289509 : Improve test coverage for XPath Axes: descendant, descendant-or-self, following, following-sibling
Joe Wang
joehw at openjdk.org
Wed Oct 5 22:10:24 UTC 2022
On Wed, 5 Oct 2022 17:28:08 GMT, Bill Huang <bhuang at openjdk.org> wrote:
>> Added test cases for xpath Axis:
>> 1. descendant
>> 2. descendant-or-self
>> 3. following
>> 4. following-sibling
>
> test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpDescendantTest.java line 65:
>
>> 63: {"/Customers/Customer[@id='x1']/descendant-or-self::Address", "/Customers/Customer[@id = 'x1']/Address"},
>> 64: {"/Customers/Customer[@id='x1']/descendant-or-self::*", "/Customers/Customer[@id='x1'] | /Customers/Customer[@id = 'x1']//*"},
>> 65: {"/Customers/foo:Customer/foo:Address/descendant-or-self::*", "/Customers/foo:Customer/foo:Address | /Customers/foo:Customer/foo:Address//*"}
>
> In the spec, there is a special note saying, "the location path //para[1] does not mean the same as the location path /descendant::para[1]". Based on this, it would be good to add a position test case for descendant. e.g.
> `/Customers/descendant::Street[2]`
> `/Customers/descendant::Street[position()=2]`
> `//Street[2]`
> `(//Street)[2]`
A more cosmetic suggestion besides Bill's technical comments, these lines are a bit too long. We still like the good old 80-character rule (slightly longer is ok), easier for people who use the Sdiffs.
-------------
PR: https://git.openjdk.org/jdk/pull/10557
More information about the core-libs-dev
mailing list