-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8289511: Improve test coverage for XPath Axes: child #9484
Conversation
👋 Welcome back bwhuang-us! A progress list of the required criteria for merging this PR into |
@bwhuang-us The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test overall. Pls see comments below.
import java.io.InputStream; | ||
|
||
/* | ||
* @test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add bug id here: @bug 8289511
* @run testng/othervm xpath.XPathChildTest | ||
* @summary Tests for XPath child axis specifier. | ||
*/ | ||
public class XPathChildTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the name to: XPathExpChildTest. The idea was to add more test cases to XPathExpTest. But since you've created the long list of test cases, it looks okay to be in a separate test.
{"/store/child::*[child::*]/author", AUTHOR_1}, | ||
{"/store/child::*[attribute::*]/author", AUTHOR_1}, | ||
{"/store/*[*][*][*][*][*][*][*][*]/author", AUTHOR_1}, | ||
{"/store/*[@*][@*][@*][@*][@*][@*][@*][@*]/author", AUTHOR_1}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we testing here, I mean vs *[*] or *[@*]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the wildcard *
selects all children of the context node, *[*] or *[@*]
will select all children that with at least one child or one attribute. This is what we cover with line 132 and 133. For line 134 and 135, we are trying to see if multiple wildcards swallow the child node in the chain.
@DataProvider(name = "invalidExp") | ||
public Object[][] getInvalidExp() { | ||
return new Object[][]{ | ||
// NullPointerException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These NPE tests need to be revisited. First of all, by the spec, NPE shall throw only "If expression or returnType is null" (and that's already covered in the Exception test). Secondly, these NPEs were not thrown by the eval process, it was merely because the NodeList was empty or Node was null. The expressions themselves were not "invalid".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. These expressions are not invalid and they are more on a focus of zero children rather than NPE. I can move them to a different test case.
…test case to zero children test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The update looks good. One more comment below.
|
||
// position | ||
{"/store/child::book[position()=1]/author", AUTHOR_1}, | ||
{"/store/child::book[last()]/author", AUTHOR_2}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intention is to test the last() function, it would be good to have more books than 2 (e.g. at least 3). But if the focus is on Axes: child, plus functions will be tested in the other subtask, I'm ok if you don't want to make further changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted. We will cover that in the XPath function() test.
@bwhuang-us This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 30 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@JoeWang-Java, @iklam) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename the issue to something more meaningful.
Pls refer to the main issue. This is one of the subtasks. |
The problem is when this commit is integrated into the JDK repo, it does not show up as a subtask of another commit. When browsing the Git commit log, we should be able to have some idea what a change is about without going to JBS. |
Sounds good. @bwhuang-us Bill, could you edit the title to match the JBS. I've changed the synopsis for all subtasks. |
/integrate |
@bwhuang-us |
/sponsor |
Going to push as commit cfe9026.
Your commit was automatically rebased without conflicts. |
@JoeWang-Java @bwhuang-us Pushed as commit cfe9026. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This is a subtask of JDK-8286091 which is aiming to improve XPath expression test coverage. The goal of this subtask is validating the XPath child axis specifier in various ways.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9484/head:pull/9484
$ git checkout pull/9484
Update a local copy of the PR:
$ git checkout pull/9484
$ git pull https://git.openjdk.org/jdk pull/9484/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9484
View PR using the GUI difftool:
$ git pr show -t 9484
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9484.diff