mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
cool, both work
This commit is contained in:
parent
1ba1e90e58
commit
b025000f20
@ -637,6 +637,37 @@ func TestDataTreeNavigatorArrayEqualsSelf(t *testing.T) {
|
||||
test.AssertResult(t, expected, resultsToString(results))
|
||||
}
|
||||
|
||||
func TestDataTreeNavigatorArrayEqualsSelfSplatFirst(t *testing.T) {
|
||||
|
||||
nodes := readDoc(t, `- cat
|
||||
- dog
|
||||
- frog`)
|
||||
|
||||
path, errPath := treeCreator.ParsePath("*(. == *og)")
|
||||
if errPath != nil {
|
||||
t.Error(errPath)
|
||||
}
|
||||
results, errNav := treeNavigator.GetMatchingNodes(nodes, path)
|
||||
|
||||
if errNav != nil {
|
||||
t.Error(errNav)
|
||||
}
|
||||
|
||||
expected := `
|
||||
-- Node --
|
||||
Document 0, path: [1]
|
||||
Tag: !!str, Kind: ScalarNode, Anchor:
|
||||
dog
|
||||
|
||||
-- Node --
|
||||
Document 0, path: [2]
|
||||
Tag: !!str, Kind: ScalarNode, Anchor:
|
||||
frog
|
||||
`
|
||||
|
||||
test.AssertResult(t, expected, resultsToString(results))
|
||||
}
|
||||
|
||||
func TestDataTreeNavigatorArrayEquals(t *testing.T) {
|
||||
|
||||
nodes := readDoc(t, `- { b: apple, animal: rabbit }
|
||||
|
Loading…
Reference in New Issue
Block a user