mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Update to latest go-yaml library, updated test w.r.t. formatting and comment handling fixes
This commit is contained in:
@@ -40,9 +40,9 @@ func TestComparePrettyCmd(t *testing.T) {
|
||||
}
|
||||
expectedOutput := ` a: simple # just the best
|
||||
b:
|
||||
- 1
|
||||
-- 2
|
||||
+- 3
|
||||
- 1
|
||||
- - 2
|
||||
+ - 3
|
||||
c:
|
||||
test: 1
|
||||
`
|
||||
|
||||
@@ -94,8 +94,8 @@ b:
|
||||
expectedOutput := `a: 2
|
||||
b:
|
||||
hi:
|
||||
- name: fred
|
||||
- name: sam
|
||||
- name: fred
|
||||
- name: sam
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
@@ -101,10 +101,10 @@ func TestMergeAppendArraysCmd(t *testing.T) {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `people:
|
||||
- name: Barry
|
||||
age: 21
|
||||
- name: Roger
|
||||
age: 44
|
||||
- name: Barry
|
||||
age: 21
|
||||
- name: Roger
|
||||
age: 44
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
@@ -146,8 +146,8 @@ another:
|
||||
document: here
|
||||
a: simple # just the best
|
||||
b:
|
||||
- 1
|
||||
- 2
|
||||
- 1
|
||||
- 2
|
||||
c:
|
||||
test: 1
|
||||
---
|
||||
@@ -317,8 +317,8 @@ func TestMergeAllowEmptyTargetCmd(t *testing.T) {
|
||||
}
|
||||
expectedOutput := `a: simple # just the best
|
||||
b:
|
||||
- 1
|
||||
- 2
|
||||
- 1
|
||||
- 2
|
||||
c:
|
||||
test: 1
|
||||
`
|
||||
|
||||
@@ -25,7 +25,7 @@ func TestNewArrayCmd(t *testing.T) {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `b:
|
||||
- 3
|
||||
- 3
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ func TestPrefixCmdArray(t *testing.T) {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `- d:
|
||||
- b:
|
||||
c: 3
|
||||
- b:
|
||||
c: 3
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
@@ -871,13 +871,13 @@ func TestReadPrettyPrintCmd(t *testing.T) {
|
||||
b:
|
||||
c: 2
|
||||
d:
|
||||
- 3
|
||||
- 4
|
||||
- 3
|
||||
- 4
|
||||
e:
|
||||
- name: fred
|
||||
value: 3
|
||||
- name: sam
|
||||
value: 4
|
||||
- name: fred
|
||||
value: 3
|
||||
- name: sam
|
||||
value: 4
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
@@ -892,13 +892,13 @@ func TestReadPrettyPrintWithIndentCmd(t *testing.T) {
|
||||
b:
|
||||
c: 2
|
||||
d:
|
||||
- 3
|
||||
- 4
|
||||
- 3
|
||||
- 4
|
||||
e:
|
||||
- name: fred
|
||||
value: 3
|
||||
- name: sam
|
||||
value: 4
|
||||
- name: fred
|
||||
value: 3
|
||||
- name: sam
|
||||
value: 4
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
@@ -914,8 +914,8 @@ func TestReadCmd_ArrayYaml_NoPath(t *testing.T) {
|
||||
hosts: lalaland
|
||||
name: "Apply smth"
|
||||
roles:
|
||||
- lala
|
||||
- land
|
||||
- lala
|
||||
- land
|
||||
serial: 1
|
||||
- become: false
|
||||
gather_facts: true
|
||||
@@ -934,8 +934,8 @@ gather_facts: false
|
||||
hosts: lalaland
|
||||
name: "Apply smth"
|
||||
roles:
|
||||
- lala
|
||||
- land
|
||||
- lala
|
||||
- land
|
||||
serial: 1
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
@@ -952,8 +952,8 @@ gather_facts: false
|
||||
hosts: lalaland
|
||||
name: "Apply smth"
|
||||
roles:
|
||||
- lala
|
||||
- land
|
||||
- lala
|
||||
- land
|
||||
serial: 1
|
||||
become: false
|
||||
gather_facts: true
|
||||
@@ -973,8 +973,8 @@ func TestReadCmd_ArrayYaml_SplatWithKeyAndValueCmd(t *testing.T) {
|
||||
hosts: lalaland
|
||||
name: "Apply smth"
|
||||
roles:
|
||||
- lala
|
||||
- land
|
||||
- lala
|
||||
- land
|
||||
serial: 1
|
||||
'[1]':
|
||||
become: false
|
||||
|
||||
@@ -261,9 +261,9 @@ func TestWriteAutoCreateCmd(t *testing.T) {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `applications:
|
||||
- name: app
|
||||
env:
|
||||
hello: world
|
||||
- name: app
|
||||
env:
|
||||
hello: world
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
@@ -476,8 +476,8 @@ func TestWriteCmd_Append(t *testing.T) {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `b:
|
||||
- foo
|
||||
- 7
|
||||
- foo
|
||||
- 7
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
@@ -508,8 +508,8 @@ func TestWriteCmd_AppendInlinePretty(t *testing.T) {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `b:
|
||||
- foo
|
||||
- 7
|
||||
- foo
|
||||
- 7
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
@@ -527,7 +527,7 @@ func TestWriteCmd_AppendEmptyArray(t *testing.T) {
|
||||
}
|
||||
expectedOutput := `a: 2
|
||||
b:
|
||||
- v
|
||||
- v
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
@@ -546,8 +546,8 @@ func TestWriteCmd_SplatArray(t *testing.T) {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `b:
|
||||
- c: new
|
||||
- c: new
|
||||
- c: new
|
||||
- c: new
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user