mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-14 07:08:06 +00:00
Fixes auto expansion of properties #1127
This commit is contained in:
parent
2e731c310f
commit
edbdb16ab7
@ -95,6 +95,7 @@ func (dec *propertiesDecoder) Decode(rootYamlNode *yaml.Node) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
properties.DisableExpansion = true
|
||||||
|
|
||||||
rootMap := &CandidateNode{
|
rootMap := &CandidateNode{
|
||||||
Node: &yaml.Node{
|
Node: &yaml.Node{
|
||||||
|
@ -144,16 +144,3 @@ person.pets.0 = dog
|
|||||||
person.food.0 = pizza
|
person.food.0 = pizza
|
||||||
```
|
```
|
||||||
|
|
||||||
## Empty doc
|
|
||||||
Given a sample.properties file of:
|
|
||||||
```properties
|
|
||||||
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
|
||||||
yq -p=props sample.properties
|
|
||||||
```
|
|
||||||
will output
|
|
||||||
```yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
|
@ -83,6 +83,13 @@ var propertyScenarios = []formatScenario{
|
|||||||
expected: expectedDecodedYaml,
|
expected: expectedDecodedYaml,
|
||||||
scenarioType: "decode",
|
scenarioType: "decode",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "does not expand automatically",
|
||||||
|
skipDoc: true,
|
||||||
|
input: "mike = ${dontExpand} this",
|
||||||
|
expected: "mike: ${dontExpand} this\n",
|
||||||
|
scenarioType: "decode",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "Roundtrip",
|
description: "Roundtrip",
|
||||||
input: expectedProperties,
|
input: expectedProperties,
|
||||||
@ -176,6 +183,9 @@ func documentRoundTripPropertyScenario(w *bufio.Writer, s formatScenario) {
|
|||||||
|
|
||||||
func documentPropertyScenario(t *testing.T, w *bufio.Writer, i interface{}) {
|
func documentPropertyScenario(t *testing.T, w *bufio.Writer, i interface{}) {
|
||||||
s := i.(formatScenario)
|
s := i.(formatScenario)
|
||||||
|
if s.skipDoc {
|
||||||
|
return
|
||||||
|
}
|
||||||
if s.scenarioType == "decode" {
|
if s.scenarioType == "decode" {
|
||||||
documentDecodePropertyScenario(w, s)
|
documentDecodePropertyScenario(w, s)
|
||||||
} else if s.scenarioType == "roundtrip" {
|
} else if s.scenarioType == "roundtrip" {
|
||||||
|
Loading…
Reference in New Issue
Block a user