mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Add test for --allow-empty flag in merge command
This commit is contained in:
parent
75c7d40c44
commit
23543ee031
@ -1084,3 +1084,17 @@ c:
|
|||||||
assertResult(t, expectedOutput, strings.Trim(gotOutput, "\n "))
|
assertResult(t, expectedOutput, strings.Trim(gotOutput, "\n "))
|
||||||
assertResult(t, os.FileMode(int(0666)), info.Mode())
|
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)
|
||||||
|
}
|
||||||
|
2
examples/empty.yaml
Normal file
2
examples/empty.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# a: apple
|
||||||
|
# b: cat
|
Loading…
Reference in New Issue
Block a user