mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
Added another scenario for find by value
This commit is contained in:
parent
67fb924e0e
commit
69caccd2d3
@ -2019,7 +2019,7 @@ func TestReadExpression(t *testing.T) {
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestReadFindValueCmd(t *testing.T) {
|
||||
func TestReadFindValueArrayCmd(t *testing.T) {
|
||||
content := `- cat
|
||||
- dog
|
||||
- rat
|
||||
@ -2037,7 +2037,7 @@ func TestReadFindValueCmd(t *testing.T) {
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestReadFindValueDeepCmd(t *testing.T) {
|
||||
func TestReadFindValueDeepArrayCmd(t *testing.T) {
|
||||
content := `animals:
|
||||
- cat
|
||||
- dog
|
||||
@ -2056,6 +2056,24 @@ func TestReadFindValueDeepCmd(t *testing.T) {
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestReadFindValueDeepObjectCmd(t *testing.T) {
|
||||
content := `animals:
|
||||
great: yes
|
||||
small: sometimes
|
||||
`
|
||||
filename := test.WriteTempYamlFile(content)
|
||||
defer test.RemoveTempYamlFile(filename)
|
||||
cmd := getRootCommand()
|
||||
result := test.RunCmd(cmd, fmt.Sprintf("r %s animals(.==yes) -ppv", filename))
|
||||
if result.Error != nil {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
|
||||
expectedOutput := `animals.great: yes
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestDeleteYamlArrayExpressionCmd(t *testing.T) {
|
||||
content := `- name: fred
|
||||
- name: cat
|
||||
|
Loading…
Reference in New Issue
Block a user