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

Delete now works with deep splat

This commit is contained in:
Mike Farah
2020-06-11 09:40:59 +10:00
parent b9e304e7a4
commit 71f5f76213
6 changed files with 61 additions and 11 deletions

View File

@@ -100,6 +100,29 @@ b:
test.AssertResult(t, expectedOutput, result.Output)
}
func TestDeleteDeepSplatArrayYaml(t *testing.T) {
content := `thing: 123
b:
hi:
- thing: item1
name: fred
`
filename := test.WriteTempYamlFile(content)
defer test.RemoveTempYamlFile(filename)
cmd := getRootCommand()
result := test.RunCmd(cmd, fmt.Sprintf("delete %s **.thing", filename))
if result.Error != nil {
t.Error(result.Error)
}
expectedOutput := `b:
hi:
- name: fred
`
test.AssertResult(t, expectedOutput, result.Output)
}
func TestDeleteSplatPrefixYaml(t *testing.T) {
content := `a: 2
b: