Skip to content

Commit

Permalink
fix: change expression language transformer to be case insensitive
Browse files Browse the repository at this point in the history
Co-authored-by: Arjen Kroezen <[email protected]>
  • Loading branch information
LeonardHd and arjendev authored Dec 13, 2024
1 parent 8ebdf86 commit f53ae44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __init__(self) -> None:
self.lark_parser = Lark(grammer, start="start", maybe_placeholders=False)

def _supported_functions(self) -> str:
functions = [f'"{f}"' for f in FunctionsRepository._functions]
functions = [f'"{f}"i' for f in FunctionsRepository._functions]
return " | ".join(functions)

def _parse(self, expression: str) -> Tree[Token]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,18 @@ def test_evaluate(
assert actual == expected_evaluation


def test_evaluate_function_names_are_case_insensitive() -> None:
# Arrange
expression = "@CONCAT('a', 'b')"
expression_runtime = ExpressionRuntime()
state = PipelineRunState()

# Act
evaluated_value = expression_runtime.evaluate(expression, state)

# Assert
assert evaluated_value == "ab"

def test_evaluate_parameter_with_complex_object_and_array_index() -> None:
# Arrange
expression = "@pipeline().parameters.parameter[0].field1.field2"
Expand Down

0 comments on commit f53ae44

Please sign in to comment.