mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 05:38:04 +00:00
Merge pull request #36 from kenjones-cisco/bugfix/write-empty-array
Bugfix: Write empty array value
This commit is contained in:
commit
b9ac6a3d9d
1
Makefile
1
Makefile
@ -74,6 +74,7 @@ install: build
|
||||
.PHONY: vendor
|
||||
vendor: tmp/dev_image_id
|
||||
${DOCKRUN} bash ./scripts/vendor.sh
|
||||
@chmod 664 vendor/vendor.json
|
||||
|
||||
# ----------------------------------------------
|
||||
# develop and test
|
||||
|
@ -248,6 +248,22 @@ func TestWriteCmd(t *testing.T) {
|
||||
assertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestWriteCmd_EmptyArray(t *testing.T) {
|
||||
content := `b: 3`
|
||||
filename := writeTempYamlFile(content)
|
||||
defer removeTempYamlFile(filename)
|
||||
|
||||
cmd := getRootCommand()
|
||||
result := runCmd(cmd, fmt.Sprintf("write %s a []", filename))
|
||||
if result.Error != nil {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `b: 3
|
||||
a: []
|
||||
`
|
||||
assertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestWriteCmd_Error(t *testing.T) {
|
||||
cmd := getRootCommand()
|
||||
result := runCmd(cmd, "write")
|
||||
|
Loading…
Reference in New Issue
Block a user