From 2bd2a85a4cb89611319f563ec88eb8d39574a562 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Fri, 21 Feb 2020 11:37:59 +1100 Subject: [PATCH] Fixed trailing empty docs --- cmd/commands_test.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/commands_test.go b/cmd/commands_test.go index 8729015..d7d7b0b 100644 --- a/cmd/commands_test.go +++ b/cmd/commands_test.go @@ -1264,8 +1264,11 @@ func TestWriteEmptyMultiDocCmd(t *testing.T) { test.AssertResult(t, expectedOutput, result.Output) } -func TestWriteTrailingEmptyMultiDocCmd(t *testing.T) { - content := `cat: frog +func TestWriteSurroundingEmptyMultiDocCmd(t *testing.T) { + content := `--- +# empty +--- +cat: frog --- # empty @@ -1274,11 +1277,15 @@ func TestWriteTrailingEmptyMultiDocCmd(t *testing.T) { defer test.RemoveTempYamlFile(filename) cmd := getRootCommand() - result := test.RunCmd(cmd, fmt.Sprintf("write %s c 7", filename)) + result := test.RunCmd(cmd, fmt.Sprintf("write %s -d1 c 7", filename)) if result.Error != nil { t.Error(result.Error) } - expectedOutput := `cat: frog + expectedOutput := ` + +# empty +--- +cat: frog c: 7 ---