mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Fixing alternative op bug #930
This commit is contained in:
parent
eea2c97cd8
commit
8941573c1a
@ -2,7 +2,7 @@ package yqlib
|
|||||||
|
|
||||||
func alternativeOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
func alternativeOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
||||||
log.Debugf("-- alternative")
|
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) {
|
func alternativeFunc(d *dataTreeNavigator, context Context, lhs *CandidateNode, rhs *CandidateNode) (*CandidateNode, error) {
|
||||||
|
@ -6,10 +6,13 @@ import (
|
|||||||
|
|
||||||
var alternativeOperatorScenarios = []expressionScenario{
|
var alternativeOperatorScenarios = []expressionScenario{
|
||||||
{
|
{
|
||||||
|
// to match jq - we do not use a readonly clone context on the LHS.
|
||||||
skipDoc: true,
|
skipDoc: true,
|
||||||
expression: `.b // .c`,
|
expression: `.b // .c`,
|
||||||
document: `a: bridge`,
|
document: `a: bridge`,
|
||||||
expected: []string{},
|
expected: []string{
|
||||||
|
"D0, P[c], (!!null)::null\n",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
skipDoc: true,
|
skipDoc: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user