Skip to content
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

Cover existence tests in logical expressions #65

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

jg-rp
Copy link
Contributor

@jg-rp jg-rp commented Mar 11, 2024

Test that singular filter queries are evaluated as existence tests when they are part of a logical expression, but not involving a comparison expression.

This was a bug for me. I was eagerly unwrapping singular node lists before evaluating comparison expression and logical expressions.

{
"name": "exists and exists, data false",
"selector" : "$[[email protected]&&@.b]",
"document" : [{"a": false, "b": false}],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an item here that doesn't match?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case has been updated to include non-matching data.

{
"name": "exists or exists, data false",
"selector" : "$[[email protected]||@.b]",
"document" : [{"a": false}, {"b": false}],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-matching data has been added to this test case, plus data that matches one side of the or expression.

@jg-rp jg-rp force-pushed the logical-existence branch from 0647adf to af48f89 Compare March 12, 2024 07:00
@gregsdennis
Copy link
Collaborator

I'll run these in my lib tomorrow. Then I'll merge.

@gregsdennis
Copy link
Collaborator

Looks good. Thanks.

@gregsdennis gregsdennis merged commit 0012d25 into jsonpath-standard:main Mar 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants