mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
29 lines
531 B
Go
29 lines
531 B
Go
|
package treeops
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
var createMapOperatorScenarios = []expressionScenario{
|
||
|
{
|
||
|
document: `{name: Mike, age: 32}`,
|
||
|
expression: `.name: .age`,
|
||
|
expected: []string{
|
||
|
"D0, P[], (!!seq)::- Mike: 32\n",
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
document: `{name: Mike, pets: [cat, dog]}`,
|
||
|
expression: `.name: .pets[]`,
|
||
|
expected: []string{
|
||
|
"D0, P[], (!!seq)::- Mike: cat\n- Mike: dog\n",
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
func TestCreateMapOperatorScenarios(t *testing.T) {
|
||
|
for _, tt := range createMapOperatorScenarios {
|
||
|
testScenario(t, &tt)
|
||
|
}
|
||
|
}
|