Add test for --allow-empty flag in merge command

This commit is contained in:
Renzo Crisóstomo 2019-03-21 11:08:11 +01:00 committed by Mike Farah
parent 75c7d40c44
commit 23543ee031
2 changed files with 16 additions and 0 deletions

View File

@ -1084,3 +1084,17 @@ c:
assertResult(t, expectedOutput, strings.Trim(gotOutput, "\n ")) assertResult(t, expectedOutput, strings.Trim(gotOutput, "\n "))
assertResult(t, os.FileMode(int(0666)), info.Mode()) assertResult(t, os.FileMode(int(0666)), info.Mode())
} }
func TestMergeAllowEmptyCmd(t *testing.T) {
cmd := getRootCommand()
result := runCmd(cmd, "merge --allow-empty examples/data1.yaml examples/empty.yaml")
if result.Error != nil {
t.Error(result.Error)
}
expectedOutput := `a: simple
b:
- 1
- 2
`
assertResult(t, expectedOutput, result.Output)
}

2
examples/empty.yaml Normal file
View File

@ -0,0 +1,2 @@
# a: apple
# b: cat