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
+5 -10
View File
@@ -57,16 +57,11 @@ var pathOperatorScenarios = []expressionScenario{
{
description: "Print path and value",
document: `{a: [cat, dog, frog]}`,
expression: `.a.[] | select(. == "*og") | [{"path":path, "value":.}]`,
expected: []string{`D0, P[], (!!seq)::- path:
- a
- 1
value: dog
- path:
- a
- 2
value: frog
`},
expression: `.a[] | select(. == "*og") | [{"path":path, "value":.}]`,
expected: []string{
"D0, P[a 1], (!!seq)::- path:\n - a\n - 1\n value: dog\n",
"D0, P[a 2], (!!seq)::- path:\n - a\n - 2\n value: frog\n",
},
},
}