-
Notifications
You must be signed in to change notification settings - Fork 7
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 function expressions as function parameters #53
Cover function expressions as function parameters #53
Conversation
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.
I like this addition. @gregsdennis care to merge?
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 look good, but I'd like to see some examples where value()
returns Nothing
(the nodelist is either empty or contains multiple elements).
For example, with this data
{
"c": "cd",
"values": [
{
"a": "ab"
},
{
"c": "d"
},
{
"a": null
}
]
}
value(@.a)
returns Nothing
for {"c": "d"}
and null
for {"a": null"}
. length()
should then return Nothing
for both of these values.
value($..c)
returns Nothing
because there are multiple matching locations.
Finally, Nothing == Nothing
returns true, meaning that the last two elements are returned in the final result:
[
{
"c": "d"
},
{
"a": null
}
]
@glyn can you verify my logic ☝️ please? This is what my lib currently does. |
LGTM |
Hi @gregsdennis, I've added a couple more cases which I believe cover the behaviour demonstrated by your example. |
f0aee1d
to
d554778
Compare
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 work for me.
These additional test cases cover using function expressions as function parameters, plus an additional
length()
case mentioned in the spec.Note that it's not currently possible to test
count()
andvalue()
with function expressions as parameters using standard function extensions alone. None of the standard function extensions return a NodesType.This PR partially replaces #51. See also the conversation on PR #51.