mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28bcbd321f | ||
|
|
9dd4503b23 | ||
|
|
185d1faadb | ||
|
|
7b004cb456 |
@@ -454,6 +454,24 @@ func TestWriteCmd_Append(t *testing.T) {
|
|||||||
assertResult(t, expectedOutput, result.Output)
|
assertResult(t, expectedOutput, result.Output)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWriteCmd_AppendEmptyArray(t *testing.T) {
|
||||||
|
content := `a: 2
|
||||||
|
`
|
||||||
|
filename := writeTempYamlFile(content)
|
||||||
|
defer removeTempYamlFile(filename)
|
||||||
|
|
||||||
|
cmd := getRootCommand()
|
||||||
|
result := runCmd(cmd, fmt.Sprintf("write %s b[+] v", filename))
|
||||||
|
if result.Error != nil {
|
||||||
|
t.Error(result.Error)
|
||||||
|
}
|
||||||
|
expectedOutput := `a: 2
|
||||||
|
b:
|
||||||
|
- v
|
||||||
|
`
|
||||||
|
assertResult(t, expectedOutput, result.Output)
|
||||||
|
}
|
||||||
|
|
||||||
func TestMergeCmd(t *testing.T) {
|
func TestMergeCmd(t *testing.T) {
|
||||||
cmd := getRootCommand()
|
cmd := getRootCommand()
|
||||||
result := runCmd(cmd, "merge examples/data1.yaml examples/data2.yaml")
|
result := runCmd(cmd, "merge examples/data1.yaml examples/data2.yaml")
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ func writeArray(context interface{}, paths []string, value interface{}) []interf
|
|||||||
case []interface{}:
|
case []interface{}:
|
||||||
array = context.([]interface{})
|
array = context.([]interface{})
|
||||||
default:
|
default:
|
||||||
array = make([]interface{}, 1)
|
array = make([]interface{}, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(paths) == 0 {
|
if len(paths) == 0 {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ var (
|
|||||||
GitDescribe string
|
GitDescribe string
|
||||||
|
|
||||||
// Version is main version number that is being run at the moment.
|
// Version is main version number that is being run at the moment.
|
||||||
Version = "1.13.0"
|
Version = "1.13.1"
|
||||||
|
|
||||||
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
|
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
|
||||||
// then it means that it is a final release. Otherwise, this is a pre-release
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||||
|
|||||||
Reference in New Issue
Block a user