mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
fixed tests
This commit is contained in:
parent
bb0e6fb857
commit
d80054dcc6
@ -91,21 +91,14 @@ Given a sample.yml file of:
|
||||
a: 1
|
||||
b: 2
|
||||
```
|
||||
And another sample another.yml file of:
|
||||
```yaml
|
||||
c: 1
|
||||
d: 2
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq eval-all 'with_entries(.key |= "KEY_" + .)' sample.yml another.yml
|
||||
yq eval 'with_entries(.key |= "KEY_" + .)' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
KEY_a: 1
|
||||
KEY_b: 2
|
||||
KEY_c: 1
|
||||
KEY_d: 2
|
||||
```
|
||||
|
||||
## Use with_entries to filter the map
|
||||
|
@ -47,6 +47,14 @@ var entriesOperatorScenarios = []expressionScenario{
|
||||
{
|
||||
description: "Use with_entries to update keys",
|
||||
document: `{a: 1, b: 2}`,
|
||||
expression: `with_entries(.key |= "KEY_" + .)`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!map)::KEY_a: 1\nKEY_b: 2\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
document: `{a: 1, b: 2}`,
|
||||
document2: `{c: 1, d: 2}`,
|
||||
expression: `with_entries(.key |= "KEY_" + .)`,
|
||||
expected: []string{
|
||||
|
Loading…
Reference in New Issue
Block a user