dmn-tck / tck

Decision Model and Notation Technology Compatibility Kit
https://dmn-tck.github.io/tck
51 stars 35 forks source link

Quesion to test case `nested009` in `1146-feel-context-put-function.dmn` #646

Closed dsntk closed 9 months ago

dsntk commented 9 months ago

Hi all,

The decision nested009 looks like this:

<decision name="nested009" id="_nested009">
    <variable name="nested009"/>
    <literalExpression>
        <text>context put({x:1, y: {a: 0}}, ["y", "a", "b", "c"], 2)</text>
    </literalExpression>
</decision>

and the expected result like this:

<testCase id="nested009">
    <description>named params - array value for 'key' gives null</description>
    <resultNode errorResult="true" name="nested009" type="decision">
        <expected>
            <value xsi:nil="true"/>
        </expected>
    </resultNode>
</testCase>

but the context put function has positional arguments provided and gives non null result like: {x:1, y: {a: {b: {c: 2}}}}

Am I missing something?

Thanks in advance for any help in clarifying this.

StrayAlien commented 9 months ago

heya - the context put(context, keys, value) function is defined as a kind of recursive call back to context put(context, key, value). That function must have a context object as the first argument.

In the above test, a has a value of 0 (zero) and is not a context so, in effect, the call is invalid - hence the null result noting an error condition of some sort.

From my reading context put operates to amend an existing context object, not create them.

dsntk commented 9 months ago

Now it's clear, thanks a lot for your help!