Array to map operator for #1415

This commit is contained in:
Mike Farah
2022-11-08 13:40:00 +11:00
parent c915113120
commit bd5e5dc965
8 changed files with 113 additions and 0 deletions
+23
View File
@@ -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)
}