Fixing alternative op bug #930

This commit is contained in:
Mike Farah 2021-09-02 15:36:23 +10:00
parent eea2c97cd8
commit 8941573c1a
2 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,7 @@ package yqlib
func alternativeOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
log.Debugf("-- alternative")
return crossFunction(d, context.ReadOnlyClone(), expressionNode, alternativeFunc, true)
return crossFunction(d, context, expressionNode, alternativeFunc, true)
}
func alternativeFunc(d *dataTreeNavigator, context Context, lhs *CandidateNode, rhs *CandidateNode) (*CandidateNode, error) {

View File

@ -6,10 +6,13 @@ import (
var alternativeOperatorScenarios = []expressionScenario{
{
// to match jq - we do not use a readonly clone context on the LHS.
skipDoc: true,
expression: `.b // .c`,
document: `a: bridge`,
expected: []string{},
expected: []string{
"D0, P[c], (!!null)::null\n",
},
},
{
skipDoc: true,