-
Notifications
You must be signed in to change notification settings - Fork 71
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
Compound queries do not evaluate false expressions properly #145
Comments
Fixed by this:
|
gongfarmer
added a commit
to gongfarmer/jsonpath
that referenced
this issue
Apr 23, 2022
…expression result strings "true"/"false" into booleans before evaluation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a compound query evaluates down to the expression true && false && true, the result is true.
It should be false.
Example:
Expected result: only ["testname3"]
Root cause:
In "parser.rb", method "#parse_parentheses", the sub-expressions have been evaluated and replaced with "true" or "false".
These values are then evaluated against the operators && or ||.
The first of the compound values has its "true" or "false" string passed to #bool_or_exp which converts it to a boolean value.
However the remaining "true" or "false" strings are never evaluated and are passed to &&= or ||= directly, where they are always treated as a true result.
The text was updated successfully, but these errors were encountered: