mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Fixing updates in square brackets #1342
This commit is contained in:
parent
6d6b693fb3
commit
6bf3defe85
@ -56,7 +56,7 @@ func collectOperator(d *dataTreeNavigator, context Context, expressionNode *Expr
|
|||||||
collectedNode := &yaml.Node{Kind: yaml.SequenceNode, Tag: "!!seq"}
|
collectedNode := &yaml.Node{Kind: yaml.SequenceNode, Tag: "!!seq"}
|
||||||
collectCandidate := candidate.CreateReplacement(collectedNode)
|
collectCandidate := candidate.CreateReplacement(collectedNode)
|
||||||
|
|
||||||
collectExpResults, err := d.GetMatchingNodes(context.SingleReadonlyChildContext(candidate), expressionNode.RHS)
|
collectExpResults, err := d.GetMatchingNodes(context.SingleChildContext(candidate), expressionNode.RHS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Context{}, err
|
return Context{}, err
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,14 @@ var collectOperatorScenarios = []expressionScenario{
|
|||||||
"D0, P[], (!!seq)::- 1\n- 2\n- 3\n",
|
"D0, P[], (!!seq)::- 1\n- 2\n- 3\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
skipDoc: true,
|
||||||
|
description: "update in collect",
|
||||||
|
expression: `[.a = "cat"]`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[], (!!seq)::- a: cat\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "Collect empty",
|
description: "Collect empty",
|
||||||
document: ``,
|
document: ``,
|
||||||
|
Loading…
Reference in New Issue
Block a user