Fix delete adding entries

This commit is contained in:
Mike Farah 2020-02-04 09:58:20 +11:00
parent 6840ea8c78
commit 6f0538173b
2 changed files with 17 additions and 1 deletions

View File

@ -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]

View File

@ -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