mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
Fix delete adding entries
This commit is contained in:
parent
6840ea8c78
commit
6f0538173b
@ -1405,6 +1405,22 @@ b:
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestDeleteDeepDoesNotExistCmd(t *testing.T) {
|
||||
content := `a: 2`
|
||||
filename := test.WriteTempYamlFile(content)
|
||||
defer test.RemoveTempYamlFile(filename)
|
||||
|
||||
cmd := getRootCommand()
|
||||
result := test.RunCmd(cmd, fmt.Sprintf("delete %s b.c", filename))
|
||||
if result.Error != nil {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
|
||||
expectedOutput := `a: 2
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestDeleteSplatYaml(t *testing.T) {
|
||||
content := `a: other
|
||||
b: [3, 4]
|
||||
|
@ -15,7 +15,7 @@ func DeleteNavigationStrategy(pathElementToDelete string) NavigationStrategy {
|
||||
return false
|
||||
},
|
||||
autoCreateMap: func(nodeContext NodeContext) bool {
|
||||
return true
|
||||
return false
|
||||
},
|
||||
visit: func(nodeContext NodeContext) error {
|
||||
node := nodeContext.Node
|
||||
|
Loading…
Reference in New Issue
Block a user