mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 05:38:04 +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 {
|
||||
return err
|
||||
}
|
||||
properties.DisableExpansion = true
|
||||
|
||||
rootMap := &CandidateNode{
|
||||
Node: &yaml.Node{
|
||||
|
@ -144,16 +144,3 @@ person.pets.0 = dog
|
||||
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,
|
||||
scenarioType: "decode",
|
||||
},
|
||||
{
|
||||
description: "does not expand automatically",
|
||||
skipDoc: true,
|
||||
input: "mike = ${dontExpand} this",
|
||||
expected: "mike: ${dontExpand} this\n",
|
||||
scenarioType: "decode",
|
||||
},
|
||||
{
|
||||
description: "Roundtrip",
|
||||
input: expectedProperties,
|
||||
@ -176,6 +183,9 @@ func documentRoundTripPropertyScenario(w *bufio.Writer, s formatScenario) {
|
||||
|
||||
func documentPropertyScenario(t *testing.T, w *bufio.Writer, i interface{}) {
|
||||
s := i.(formatScenario)
|
||||
if s.skipDoc {
|
||||
return
|
||||
}
|
||||
if s.scenarioType == "decode" {
|
||||
documentDecodePropertyScenario(w, s)
|
||||
} else if s.scenarioType == "roundtrip" {
|
||||
|
Loading…
Reference in New Issue
Block a user