mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Fixing entries test
This commit is contained in:
parent
ed377a032d
commit
01e478e81d
@ -98,7 +98,8 @@ KEY_a: 1
|
||||
KEY_b: 2
|
||||
```
|
||||
|
||||
Using with_entries is also useful whe you want to filter a map. Given a sample.yml file of:
|
||||
## Use with_entries to filter the map
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
a:
|
||||
b: bird
|
||||
@ -114,3 +115,4 @@ will output
|
||||
a:
|
||||
b: bird
|
||||
```
|
||||
|
||||
|
@ -53,11 +53,11 @@ var entriesOperatorScenarios = []expressionScenario{
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Use with_entries to filter keys",
|
||||
document: `{a: b: "bird", c: d: "dog"}`,
|
||||
expression: `with_entries(.value | has("b"))`,
|
||||
description: "Use with_entries to filter the map",
|
||||
document: `{a: { b: bird }, c: { d: dog }}`,
|
||||
expression: `with_entries(select(.value | has("b")))`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!map)::a:\n b: \"bird\"\n",
|
||||
"D0, P[], (!!map)::a: {b: bird}\n",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user