1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00
yq/pkg/yqlib/operator_entries_test.go
2021-05-09 13:59:23 +10:00

32 lines
662 B
Go

package yqlib
import (
"testing"
)
var entriesOperatorScenarios = []expressionScenario{
{
description: "to_entries Map",
document: `{a: 1, b: 2}`,
expression: `to_entries`,
expected: []string{
"D0, P[], (!!seq)::- key: a\n value: 1\n- key: b\n value: 2\n",
},
},
{
description: "to_entries Array",
document: `[a, b]`,
expression: `to_entries`,
expected: []string{
"D0, P[], (!!seq)::- key: 0\n value: a\n- key: 1\n value: b\n",
},
},
}
func TestEntriesOperatorScenarios(t *testing.T) {
for _, tt := range entriesOperatorScenarios {
testScenario(t, &tt)
}
documentScenarios(t, "Entries", entriesOperatorScenarios)
}