mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-04 03:15:39 +00:00
Add tests for invalid merge key handling for traverse
This commit is contained in:
parent
b7aa711d94
commit
08ecd39a1e
@ -612,6 +612,25 @@ var traversePathOperatorScenarios = []expressionScenario{
|
|||||||
"D0, P[a], (!!int)::2\n",
|
"D0, P[a], (!!int)::2\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
skipDoc: true,
|
||||||
|
description: "Traversing map with invalid merge anchor should not fail",
|
||||||
|
subdescription: "Otherwise code cannot do anything with it",
|
||||||
|
document: `{a: 42, <<: 37}`,
|
||||||
|
expression: `.a`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[a], (!!int)::42\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skipDoc: true,
|
||||||
|
description: "Directly accessing invalid merge anchor should not fail",
|
||||||
|
document: `{<<: 37}`,
|
||||||
|
expression: `.<<`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[<<], (!!int)::37\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTraversePathOperatorScenarios(t *testing.T) {
|
func TestTraversePathOperatorScenarios(t *testing.T) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user