yq/pkg/yqlib/treeops/operator_create_map_test.go

29 lines
531 B
Go
Raw Normal View History

2020-10-21 01:54:58 +00:00
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)
}
}