mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 00:54:51 +08:00
Fixed collect op when working with multiple nodes
This commit is contained in:
@@ -5,6 +5,15 @@ import (
|
||||
)
|
||||
|
||||
var collectObjectOperatorScenarios = []expressionScenario{
|
||||
{
|
||||
skipDoc: true,
|
||||
document: `[{name: cat}, {name: dog}]`,
|
||||
expression: `.[] | {.name: "great"}`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!map)::cat: great\n",
|
||||
"D0, P[], (!!map)::dog: great\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
document: "a: []",
|
||||
@@ -99,9 +108,7 @@ var collectObjectOperatorScenarios = []expressionScenario{
|
||||
document: `{name: Mike, pets: {cows: [apl, bba]}}`,
|
||||
expression: `{"a":.name, "b":.pets}`,
|
||||
expected: []string{
|
||||
`D0, P[], (!!map)::a: Mike
|
||||
b: {cows: [apl, bba]}
|
||||
`,
|
||||
"D0, P[], (!!map)::a: Mike\nb: {cows: [apl, bba]}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user