mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 22:44:50 +08:00
Fixed handling of merging null #1501
This commit is contained in:
@@ -579,6 +579,41 @@ var multiplyOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (doc)::a: {a: apple is included, b: cool.}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Merging a null with a map",
|
||||
expression: `null * {"some": "thing"}`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!map)::some: thing\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Merging a map with null",
|
||||
expression: `{"some": "thing"} * null`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!map)::some: thing\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Merging an null with an array",
|
||||
expression: `null * ["some"]`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!seq)::- some\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Merging an array with null",
|
||||
expression: `["some"] * null`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!seq)::- some\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
expression: `null * null`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!null)::null\n",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestMultiplyOperatorScenarios(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user