fixed boolean example

This commit is contained in:
Mike Farah 2020-11-20 15:33:21 +11:00
parent 663413cd7a
commit 356aac5a1f
2 changed files with 7 additions and 8 deletions

View File

@ -32,13 +32,13 @@ Given a sample.yml file of:
```
then
```bash
yq eval '.[] | select(.a == "cat" or .b == "dog")' sample.yml
yq eval '[.[] | select(.a == "cat" or .b == "dog")]' sample.yml
```
will output
```yaml
a: bird
b: dog
a: cat
b: fly
- a: bird
b: dog
- a: cat
b: fly
```

View File

@ -22,10 +22,9 @@ var booleanOperatorScenarios = []expressionScenario{
{
document: "[{a: bird, b: dog}, {a: frog, b: bird}, {a: cat, b: fly}]",
description: "Matching nodes with select, equals and or",
expression: `.[] | select(.a == "cat" or .b == "dog")`,
expression: `[.[] | select(.a == "cat" or .b == "dog")]`,
expected: []string{
"D0, P[0], (!!map)::{a: bird, b: dog}\n",
"D0, P[2], (!!map)::{a: cat, b: fly}\n",
"D0, P[], (!!seq)::- {a: bird, b: dog}\n- {a: cat, b: fly}\n",
},
},
{