mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Generic ast (#1829)
Remove dependency on yaml.Node for internal AST representation. Yaml decoder is now just another decoder.
This commit is contained in:
@@ -10,7 +10,7 @@ var selectOperatorScenarios = []expressionScenario{
|
||||
document: `cat`,
|
||||
expression: `select(false, true)`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::cat\n",
|
||||
"D0, P[], (!!str)::cat\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -18,7 +18,7 @@ var selectOperatorScenarios = []expressionScenario{
|
||||
document: `cat`,
|
||||
expression: `select(true, false)`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::cat\n",
|
||||
"D0, P[], (!!str)::cat\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -71,8 +71,8 @@ var selectOperatorScenarios = []expressionScenario{
|
||||
document2: "b: world",
|
||||
expression: `select(.a == "hello" or .b == "world")`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::a: hello\n",
|
||||
"D0, P[], (doc)::b: world\n",
|
||||
"D0, P[], (!!map)::a: hello\n",
|
||||
"D0, P[], (!!map)::b: world\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -81,7 +81,7 @@ var selectOperatorScenarios = []expressionScenario{
|
||||
document: `[{animal: cat, legs: {cool: true}}, {animal: fish}]`,
|
||||
expression: `(.[] | select(.legs.cool == true).canWalk) = true | (.[] | .alive.things) = "yes"`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::[{animal: cat, legs: {cool: true}, canWalk: true, alive: {things: yes}}, {animal: fish, alive: {things: yes}}]\n",
|
||||
"D0, P[], (!!seq)::[{animal: cat, legs: {cool: true}, canWalk: true, alive: {things: yes}}, {animal: fish, alive: {things: yes}}]\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -121,7 +121,7 @@ var selectOperatorScenarios = []expressionScenario{
|
||||
document: `a: { things: cat, bob: goat, horse: dog }`,
|
||||
expression: `(.a.[] | select(. == "cat" or . == "goat")) |= "rabbit"`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::a: {things: rabbit, bob: rabbit, horse: dog}\n",
|
||||
"D0, P[], (!!map)::a: {things: rabbit, bob: rabbit, horse: dog}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user