mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 05:34:51 +08:00
Array to map operator for #1415
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package yqlib
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var arrayToMapScenarios = []expressionScenario{
|
||||
{
|
||||
description: "Simple example",
|
||||
document: `cool: [null, null, hello]`,
|
||||
expression: `.cool |= array_to_map`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::cool:\n 2: hello\n",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestArrayToMapScenarios(t *testing.T) {
|
||||
for _, tt := range arrayToMapScenarios {
|
||||
testScenario(t, &tt)
|
||||
}
|
||||
documentOperatorScenarios(t, "array-to-map", arrayToMapScenarios)
|
||||
}
|
||||
Reference in New Issue
Block a user