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

Fixed deep splatting merge anchors - dont visit twice

This commit is contained in:
Mike Farah
2020-02-04 14:10:12 +11:00
parent 6f0538173b
commit 02258fbaae
2 changed files with 30 additions and 3 deletions

View File

@@ -247,6 +247,32 @@ func TestReadAnchorsWithKeyAndValueCmd(t *testing.T) {
test.AssertResult(t, "foobar.a: 1\n", result.Output)
}
func TestReadAllAnchorsWithKeyAndValueCmd(t *testing.T) {
cmd := getRootCommand()
result := test.RunCmd(cmd, "read -p pv ../examples/merge-anchor.yaml **")
if result.Error != nil {
t.Error(result.Error)
}
expectedOutput := `foo.a: original
foo.thing: coolasdf
foo.thirsty: yep
bar.b: 2
bar.thing: coconut
bar.c: oldbar
foobarList.c: newbar
foobarList.b: 2
foobarList.thing: coconut
foobarList.a: original
foobarList.thirsty: yep
foobar.thirty: well beyond
foobar.thing: ice
foobar.c: 3
foobar.a: original
foobar.thirsty: yep
`
test.AssertResult(t, expectedOutput, result.Output)
}
func TestReadMergeAnchorsOriginalCmd(t *testing.T) {
cmd := getRootCommand()
result := test.RunCmd(cmd, "read ../examples/merge-anchor.yaml foobar.a")