mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
more docs
This commit is contained in:
parent
af2aa9ad91
commit
b3efcdc202
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
var recursiveDescentOperatorScenarios = []expressionScenario{
|
var recursiveDescentOperatorScenarios = []expressionScenario{
|
||||||
{
|
{
|
||||||
|
skipDoc: true,
|
||||||
document: `cat`,
|
document: `cat`,
|
||||||
expression: `..`,
|
expression: `..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -13,6 +14,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
skipDoc: true,
|
||||||
document: `{a: frog}`,
|
document: `{a: frog}`,
|
||||||
expression: `..`,
|
expression: `..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -21,6 +23,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
description: "Map",
|
||||||
document: `{a: {b: apple}}`,
|
document: `{a: {b: apple}}`,
|
||||||
expression: `..`,
|
expression: `..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -30,6 +33,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
description: "Array",
|
||||||
document: `[1,2,3]`,
|
document: `[1,2,3]`,
|
||||||
expression: `..`,
|
expression: `..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -40,6 +44,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
description: "Array of maps",
|
||||||
document: `[{a: cat},2,true]`,
|
document: `[{a: cat},2,true]`,
|
||||||
expression: `..`,
|
expression: `..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -51,6 +56,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
description: "Aliases are not traversed",
|
||||||
document: `{a: &cat {c: frog}, b: *cat}`,
|
document: `{a: &cat {c: frog}, b: *cat}`,
|
||||||
expression: `..`,
|
expression: `..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -61,6 +67,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
description: "Merge docs are not traversed",
|
||||||
document: mergeDocSample,
|
document: mergeDocSample,
|
||||||
expression: `.foobar | ..`,
|
expression: `.foobar | ..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -71,6 +78,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
skipDoc: true,
|
||||||
document: mergeDocSample,
|
document: mergeDocSample,
|
||||||
expression: `.foobarList | ..`,
|
expression: `.foobarList | ..`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -88,4 +96,5 @@ func TestRecursiveDescentOperatorScenarios(t *testing.T) {
|
|||||||
for _, tt := range recursiveDescentOperatorScenarios {
|
for _, tt := range recursiveDescentOperatorScenarios {
|
||||||
testScenario(t, &tt)
|
testScenario(t, &tt)
|
||||||
}
|
}
|
||||||
|
documentScenarios(t, "Recursive Descent Operator", recursiveDescentOperatorScenarios)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user