-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: Handle non-existing variables #705
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Change the base test class to FeelEngineTest with EvaluationResultMatchers. This aligns with the new test style and improves the readability.
Change the behavior to return null if a referenced variable doesn't exist. Additionally, the evaluation reports a suppressed failure for debugging purpose. Previously, the evaluation failed if a variable doesn't exist. This behavioral change is aligned with the DMN specification and improves the handling of null and non-existing variables.
The test case is now working because the missing variable is replaced with null. We can be enabled the test case.
Change the behavior to return null if the input value of a unary-tests expression doesn't exist. Previously, the evaluation failed if the input value doesn't exist.
The built-in function `is defined()` doesn't work anymore. By returning `null` for a non-existing variable, the function returns always `true`. Previously, the function was used to check if a variable or context entry exists. See the issue for details: #695.
This test case doesn't work anymore because the evaluation doesn't fail if the input value is missing. Instead, the input value is replaced with `null`.
These test cases don't work anymore because the evaluation doesn't fail if the input value is missing. Instead, the input value is replaced with `null`.
This test case had a wrong assumption. Previously, the test case failed because of the missing input value but not because the parsing. Since the evaluation doesn't fail anymore with a missing input value, we can remove the test case.
nicpuppa
approved these changes
Sep 7, 2023
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 love the refactor of the tests ❤️
LGTM 💪 🚀
I just leave some thoughts, please have a look if you want 👀
...t/scala/org/camunda/feel/impl/interpreter/InterpreterNonExistingVariableExpressionTest.scala
Outdated
Show resolved
Hide resolved
src/test/scala/org/camunda/feel/api/context/CustomContextTest.scala
Outdated
Show resolved
Hide resolved
src/test/scala/org/camunda/feel/api/context/CustomContextTest.scala
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Change the behavior of the FEEL engine to replace a non-existing variable and a non-existing input value with
null
. Previously, the evaluation failed in these cases.A note to the reviewer, the actual code fix is very small. The major changes are refactorings in the test classes to adopt the new test style.
Related issues
closes #674