File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
commonMain/kotlin/org/hisp/dhis/lib/expression/eval
commonTest/kotlin/org/hisp/dhis/lib/expression/function Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ repositories {
99 mavenCentral()
1010}
1111
12- version = " 1.1.7 -SNAPSHOT"
12+ version = " 1.1.8 -SNAPSHOT"
1313group = " org.hisp.dhis.lib.expression"
1414
1515if (project.hasProperty(" removeSnapshotSuffix" )) {
Original file line number Diff line number Diff line change @@ -93,7 +93,11 @@ internal class Calculator(
9393 NamedFunction .d2_hasUserRole -> functions.d2_hasUserRole(
9494 evalToString(fn.child(0 )),
9595 data.supplementaryValues[" USER" ])
96- NamedFunction .d2_hasValue -> functions.d2_hasValue(evalToVar(fn.child(0 )))
96+ NamedFunction .d2_hasValue -> try {
97+ functions.d2_hasValue(evalToVar(fn.child(0 )))
98+ } catch (e: IllegalExpressionException ) {
99+ false
100+ }
97101 NamedFunction .d2_inOrgUnitGroup -> functions.d2_inOrgUnitGroup(
98102 evalToString(fn.child(0 )),
99103 data.programRuleVariableValues[" org_unit" ],
Original file line number Diff line number Diff line change @@ -15,10 +15,17 @@ import kotlin.test.assertEquals
1515 */
1616internal class HasValueTest : AbstractVariableBasedTest () {
1717 @Test
18- fun return_false_for_non_existing_variable () {
18+ fun return_false_for_non_existing_variable_with_UID () {
19+ // 'nonexisting' is treated as valid UID
1920 assertHasValue(" d2:hasValue(#{nonexisting})" , mapOf (), false )
2021 }
2122
23+ @Test
24+ fun return_false_for_non_existing_variable_with_name () {
25+ assertHasValue(" d2:hasValue(#{variable-name})" , mapOf (), false )
26+ }
27+
28+
2229 @Test
2330 fun return_false_for_existing_variable_without_value () {
2431 assertHasValue(
You can’t perform that action at this time.
0 commit comments