1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Fixed empty merge problem - need to visit empty arrays and objects

This commit is contained in:
Mike Farah
2020-02-13 14:56:54 +11:00
parent d83c46eec2
commit 83c13ce392
2 changed files with 27 additions and 1 deletions

View File

@@ -575,6 +575,28 @@ func TestReadEmptyContentCmd(t *testing.T) {
test.AssertResult(t, expectedOutput, result.Output)
}
func TestReadEmptyNodesPrintPathCmd(t *testing.T) {
content := `map:
that: {}
array:
great: []
null:
indeed: ~`
filename := test.WriteTempYamlFile(content)
defer test.RemoveTempYamlFile(filename)
cmd := getRootCommand()
result := test.RunCmd(cmd, fmt.Sprintf("read %s -ppv **", filename))
if result.Error != nil {
t.Error(result.Error)
}
expectedOutput := `map.that: {}
array.great: []
null.indeed: ~
`
test.AssertResult(t, expectedOutput, result.Output)
}
func TestReadEmptyContentWithDefaultValueCmd(t *testing.T) {
content := ``
filename := test.WriteTempYamlFile(content)