mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 05:38:04 +00:00
Fixed trailing empty docs
This commit is contained in:
parent
ceb76e5c17
commit
2bd2a85a4c
@ -1264,8 +1264,11 @@ func TestWriteEmptyMultiDocCmd(t *testing.T) {
|
|||||||
test.AssertResult(t, expectedOutput, result.Output)
|
test.AssertResult(t, expectedOutput, result.Output)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWriteTrailingEmptyMultiDocCmd(t *testing.T) {
|
func TestWriteSurroundingEmptyMultiDocCmd(t *testing.T) {
|
||||||
content := `cat: frog
|
content := `---
|
||||||
|
# empty
|
||||||
|
---
|
||||||
|
cat: frog
|
||||||
---
|
---
|
||||||
|
|
||||||
# empty
|
# empty
|
||||||
@ -1274,11 +1277,15 @@ func TestWriteTrailingEmptyMultiDocCmd(t *testing.T) {
|
|||||||
defer test.RemoveTempYamlFile(filename)
|
defer test.RemoveTempYamlFile(filename)
|
||||||
|
|
||||||
cmd := getRootCommand()
|
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 {
|
if result.Error != nil {
|
||||||
t.Error(result.Error)
|
t.Error(result.Error)
|
||||||
}
|
}
|
||||||
expectedOutput := `cat: frog
|
expectedOutput := `
|
||||||
|
|
||||||
|
# empty
|
||||||
|
---
|
||||||
|
cat: frog
|
||||||
c: 7
|
c: 7
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user