Fixed trailing empty docs

This commit is contained in:
Mike Farah 2020-02-21 11:37:59 +11:00
parent ceb76e5c17
commit 2bd2a85a4c
1 changed files with 11 additions and 4 deletions

View File

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