diff --git a/commands_test.go b/commands_test.go index c228a14..2e4924a 100644 --- a/commands_test.go +++ b/commands_test.go @@ -1084,3 +1084,17 @@ c: assertResult(t, expectedOutput, strings.Trim(gotOutput, "\n ")) 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) +} diff --git a/examples/empty.yaml b/examples/empty.yaml new file mode 100644 index 0000000..33fe031 --- /dev/null +++ b/examples/empty.yaml @@ -0,0 +1,2 @@ +# a: apple +# b: cat