From 23543ee03128880f18295ab4c51dfda97893760e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renzo=20Cris=C3=B3stomo?= Date: Thu, 21 Mar 2019 11:08:11 +0100 Subject: [PATCH] Add test for --allow-empty flag in merge command --- commands_test.go | 14 ++++++++++++++ examples/empty.yaml | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 examples/empty.yaml 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