Fixed collect op when working with multiple nodes

This commit is contained in:
Mike Farah
2021-11-30 13:19:44 +11:00
parent d41b44dc42
commit feb97c9872
12 changed files with 172 additions and 83 deletions
+10 -3
View File
@@ -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",
},
},
{