mirror of
https://gitee.com/mirrors_adrian-thurston/yq.git
synced 2026-01-15 07:53:35 +08:00
Cleanup test
This commit is contained in:
@@ -157,26 +157,6 @@ b: |
|
|||||||
bob: dylan
|
bob: dylan
|
||||||
```
|
```
|
||||||
|
|
||||||
## Encode value as yaml string, using toyaml
|
|
||||||
Does the same thing as to_yaml, matching jq naming convention.
|
|
||||||
|
|
||||||
Given a sample.yml file of:
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
cool: thing
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
|
||||||
yq eval '.b = (.a | to_yaml)' sample.yml
|
|
||||||
```
|
|
||||||
will output
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
cool: thing
|
|
||||||
b: |
|
|
||||||
cool: thing
|
|
||||||
```
|
|
||||||
|
|
||||||
## Decode a yaml encoded string
|
## Decode a yaml encoded string
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -90,10 +90,9 @@ var encoderDecoderOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Encode value as yaml string, using toyaml",
|
skipDoc: true,
|
||||||
subdescription: "Does the same thing as to_yaml, matching jq naming convention.",
|
document: `{a: {cool: "thing"}}`,
|
||||||
document: `{a: {cool: "thing"}}`,
|
expression: `.b = (.a | to_yaml)`,
|
||||||
expression: `.b = (.a | to_yaml)`,
|
|
||||||
expected: []string{
|
expected: []string{
|
||||||
`D0, P[], (doc)::{a: {cool: "thing"}, b: "{cool: \"thing\"}\n"}
|
`D0, P[], (doc)::{a: {cool: "thing"}, b: "{cool: \"thing\"}\n"}
|
||||||
`,
|
`,
|
||||||
|
|||||||
Reference in New Issue
Block a user