can assign children!

This commit is contained in:
Mike Farah 2020-10-16 12:49:15 +11:00
parent fccd03036f
commit 59296b7d12

View File

@ -724,6 +724,31 @@ func TestDataTreeNavigatorSimpleAssignBooleanCmd(t *testing.T) {
test.AssertResult(t, expected, resultsToString(results))
}
func TestDataTreeNavigatorSimpleAssignChildCmd(t *testing.T) {
nodes := readDoc(t, `a:
b: {g: 3}`)
path, errPath := treeCreator.ParsePath(`.a |= .b`)
if errPath != nil {
t.Error(errPath)
}
results, errNav := treeNavigator.GetMatchingNodes(nodes, path)
if errNav != nil {
t.Error(errNav)
}
expected := `
-- Node --
Document 0, path: [a]
Tag: !!map, Kind: MappingNode, Anchor:
{g: 3}
`
test.AssertResult(t, expected, resultsToString(results))
}
func TestDataTreeNavigatorSimpleAssignSelf(t *testing.T) {
nodes := readDoc(t, `a: