1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Fixed deep read at root level

This commit is contained in:
Mike Farah
2020-06-15 12:31:13 +10:00
parent 07cd3d4b8b
commit 89cbe63343
6 changed files with 37 additions and 31 deletions

View File

@@ -1207,6 +1207,26 @@ func TestReadBadDataCmd(t *testing.T) {
test.AssertResult(t, expectedOutput, result.Error.Error())
}
func TestReadDeepFromRootCmd(t *testing.T) {
content := `state:
country:
city: foo
`
filename := test.WriteTempYamlFile(content)
defer test.RemoveTempYamlFile(filename)
cmd := getRootCommand()
result := test.RunCmd(cmd, fmt.Sprintf("read %s (**.city==foo)", filename))
if result.Error != nil {
t.Error(result.Error)
}
expectedOutput := `country:
city: foo
`
test.AssertResult(t, expectedOutput, result.Output)
}
func TestReadSplatPrefixCmd(t *testing.T) {
content := `a: 2
b: